Update the shipping option for subscriptions on address change

This commit is contained in:
Narek Zakarian 2024-06-03 15:27:01 +04:00
parent ac42b18592
commit 4967c472e7
No known key found for this signature in database
GPG key ID: 07AFD7E7A9C164A7
2 changed files with 15 additions and 2 deletions

View file

@ -391,6 +391,21 @@ const PayPalComponent = ({
await shippingData.setShippingAddress(address);
const res = await fetch(config.ajax.update_shipping.endpoint, {
method: 'POST',
credentials: 'same-origin',
body: JSON.stringify({
nonce: config.ajax.update_shipping.nonce,
order_id: data.orderID,
})
});
const json = await res.json();
if (!json.success) {
throw new Error(json.data.message);
}
} catch (e) {
console.error(e);