Fix checkout address update

Looks like update* only sends to server, and set* fills UI without immediately sending to the server
This commit is contained in:
Alex P 2023-04-27 09:29:37 +03:00
parent 45986d3961
commit 885d7cab19
No known key found for this signature in database
GPG key ID: 54487A734A204D71

View file

@ -133,8 +133,6 @@ const PayPalComponent = ({
let handleShippingChange = null;
if (shippingData.needsShipping && !config.finalReviewEnabled) {
handleShippingChange = async (data, actions) => {
console.log(data)
try {
const shippingOptionId = data.selected_shipping_option?.id;
if (shippingOptionId) {
@ -147,6 +145,8 @@ const PayPalComponent = ({
shipping_address: address,
});
await shippingData.setShippingAddress(address);
const res = await fetch(config.ajax.update_shipping.endpoint, {
method: 'POST',
credentials: 'same-origin',