0
votes

Good morning. Thanks to the code provided here WooCommerce - get shipping country for non registered user I managed to add the correct discount to my checkout.

A brief resume: I had to discount the full shipping cost in case the order comes from specific country. But I cannot use the standard free shipping procedure, because I have to know the amount of the shipping costs to use it somewere after the checkout. That's why I added the some code to apply a negative fee to the woocommerce_cart_calculate_fees hook.

When I try to pay via PayPal I receive this error "https://www.paypal.com/webapps/shoppingcart/error?flowlogging_id=IDd&code=AMOUNT_ERROR&mfid=MFID"

I believe that PayPal does not evaluate the new total amount.

I tried to echo the $cart->total value inside woocommerce_after_calculate_totals hook, and it's OK. So Paypal is looking at another value...

What can I do?

This is what I get (sorry for the partial translation)

enter image description here

Thanks!

1

1 Answers

0
votes

PayPal evaluates what you send it -- so, review a log of what your browser is actually sending in the request. Use the Dev Tools 'Network' tab.

And try the latest PayPal for WooCommerce plugin, which has an option to enable Smart Buttons that use an API instead of redirecting with the amount, among other things: https://woocommerce.com/products/woocommerce-gateway-paypal-checkout/