WordPress.org

Forums

WooCommerce Bulk Discount
Price rounding issues in paypal (7 posts)

  1. darkskycreations
    Member
    Posted 1 year ago #

    Im receiving a Validation Error from Paypal: Validation error: Paypal amounts do not match. Order status changed to hold.

    I did some investigation and found that whatever price is being displayed on the woocommerce checkout page is correct eg $6.54. But when it is being pass onto paypal side that is not the case eg. ($6.54 is rounded to $6.50)

    Has anyone encounter such problems? Im just trying to rule out its not this plugin thats causing the bug.

    Any solutions is much appreciated. thanks

    http://wordpress.org/plugins/woocommerce-bulk-discount/

  2. cjurczak
    Member
    Posted 1 year ago #

    I am getting an error from Paypal:
    10413: The totals of the cart item amounts do not match order amounts.

    I suspect a rounding problem as well. It only happens on certain % discounts.

    I was going to take a site live this week, but cannot without this functionality working.

  3. cjurczak
    Member
    Posted 1 year ago #

    It seems to be any discounted % over 60.004% with a quantity of 1000 that gives me the trouble.

    And 60.02 with a quantity of 100, gives me the same problem.

  4. Djinn22
    Member
    Posted 6 months ago #

    did you guys figure this out??

  5. Craig Cooper
    Member
    Posted 6 months ago #

    I'm getting this very same error.

    I think if we could round the amount at the point of discount it will solve the problem.

    In my case I have 0.85 with a 15% discount which is 0.7225.

    Unfortunately paypal receives 0.72 and so with any quantity greater than 4 there is a mismatch in paypal's calculation of the amount and WooCommerce's.

  6. Craig Cooper
    Member
    Posted 6 months ago #

    I'd be happy to modify the code myself if I knew where to add the code to round the figure .

  7. Craig Cooper
    Member
    Posted 6 months ago #

    Ok, so I dug into the code and I found this at line 366:

    $row_base_price = $_product->get_price() * $this->discount_coeffs[$this->get_actual_id( $_product )]['coeff'];

    I changed it to this:

    $row_base_price = round($_product->get_price() * $this->discount_coeffs[$this->get_actual_id( $_product )]['coeff'],2);

    And now the prices are rounded BEFORE they are calculated. So if your price is 0.7525 or something similar after the discount is calculated it is rounded to two decimal places (standard for many currencies) before it is multiplied by the quantity for the subtotal.

    So the discount is technically less precise but it means you can actually checkout with Paypal.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce Bulk Discount
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic