Pass save payment method checkbox value

This commit is contained in:
Emili Castells Guasch 2023-11-27 16:00:12 +01:00
parent 7a8650dbfa
commit cd8564d81e
4 changed files with 30 additions and 20 deletions

View file

@ -56,6 +56,8 @@ class CheckoutActionHandler {
const paymentMethod = getCurrentPaymentMethod();
const fundingSource = window.ppcpFundingSource;
const savePaymentMethod = !!document.getElementById('wc-ppcp-credit-card-gateway-new-payment-method')?.checked;
return fetch(this.config.ajax.create_order.endpoint, {
method: 'POST',
headers: {
@ -72,7 +74,8 @@ class CheckoutActionHandler {
funding_source: fundingSource,
// send as urlencoded string to handle complex fields via PHP functions the same as normal form submit
form_encoded: new URLSearchParams(formData).toString(),
createaccount: createaccount
createaccount: createaccount,
save_payment_method: savePaymentMethod
})
}).then(function (res) {
return res.json();