allow skipping confirmation page for subscriptions

This commit is contained in:
Narek Zakarian 2024-05-21 18:41:27 +04:00
parent 9a55140802
commit 1de72ed0bf
No known key found for this signature in database
GPG key ID: 07AFD7E7A9C164A7
3 changed files with 65 additions and 11 deletions

View file

@ -23,7 +23,8 @@ class CartActionHandler {
body: JSON.stringify({
nonce: this.config.ajax.approve_subscription.nonce,
order_id: data.orderID,
subscription_id: data.subscriptionID
subscription_id: data.subscriptionID,
should_create_wc_order: !context.config.vaultingEnabled || data.paymentSource !== 'venmo'
})
}).then((res)=>{
return res.json();
@ -33,7 +34,9 @@ class CartActionHandler {
throw Error(data.data.message);
}
location.href = this.config.redirect;
let orderReceivedUrl = data.data?.order_received_url
location.href = orderReceivedUrl ? orderReceivedUrl : context.config.redirect;
});
},
onError: (err) => {