WordPress.org

Support

Support » Plugins and Hacks » WooCommerce Bulk Discount » Price rounding issues in paypal

Price rounding issues in paypal

  • 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/

Viewing 6 replies - 1 through 6 (of 6 total)
  • 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.

    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.

    Djinn22

    @djinn22

    did you guys figure this out??

    Craig Cooper

    @webcopysearch

    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.

    Craig Cooper

    @webcopysearch

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

    Craig Cooper

    @webcopysearch

    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.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Price rounding issues in paypal’ is closed to new replies.
Skip to toolbar