How do I update shipping in the popup when using onShippingAddressChange()

vindolin
Contributor
Contributor

I've implemented my own checkout process for my site some time ago which has only a handful of products.

I'm just using a static page with some JS that handles my cart/products.

A US customer contacted me and told me he can't order from my site and he got this error: "Your order can't be shipped to this address"

I checked the SDK documentation and discovered that onShippingChange() was now deprecated and after migrating to onShippingAddressChange() that error was gone.

What I don't get is the correct workflow for handling the address/shipping fee change.

In my onShippingAddressChange() callback I use data.shippingAddress.countryCode to lookup the shipping costs for the selected address and update the cart on my page accordingly, this part works.

But the price in the popup stays the same.

How do I update the total price in the popup?

I tried to return actions.buildOrderPatchPayload() with a shippingOptions item but that had no effect.

 

Any ideas/example code?

 

Login to Me Too
3 REPLIES 3

jedhelmers
Contributor
Contributor

Did you figure this out? I've spent two days trying to solve a similar issue with not being able to refresh the order price in the PayPal window. I've called the order patch successfully from Postman which updates the actual value, but the displayed value does not change until I reload the PayPal window.

Login to Me Too

vindolin
Contributor
Contributor

Sadly no. Currently I have to charge the same shipping cost for EU and non EU countries 😠

 

 

Login to Me Too

unholycorndog
Contributor
Contributor

Similar issue. I keep getting an error that buildOrderPatchPayload is not allowed.

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.