mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Add ApplePay reactivity to product quantity
This commit is contained in:
parent
6930422188
commit
2eeff9a3bc
1 changed files with 16 additions and 4 deletions
|
@ -24,9 +24,7 @@ class ApplepayButton {
|
||||||
);
|
);
|
||||||
|
|
||||||
//PRODUCT DETAIL PAGE
|
//PRODUCT DETAIL PAGE
|
||||||
if(this.context === 'product') {
|
this.refreshContextData();
|
||||||
this.productQuantity = document.querySelector('input.qty').value
|
|
||||||
}
|
|
||||||
|
|
||||||
this.updated_contact_info = []
|
this.updated_contact_info = []
|
||||||
this.selectedShippingMethod = []
|
this.selectedShippingMethod = []
|
||||||
|
@ -198,7 +196,8 @@ class ApplepayButton {
|
||||||
try {
|
try {
|
||||||
const formData = new FormData(document.querySelector(checkoutFormSelector));
|
const formData = new FormData(document.querySelector(checkoutFormSelector));
|
||||||
this.form_saved = Object.fromEntries(formData.entries());
|
this.form_saved = Object.fromEntries(formData.entries());
|
||||||
this.update_request_data_with_form(paymentDataRequest);
|
// This line should be reviewed, the paypal.Applepay().confirmOrder fails if we add it.
|
||||||
|
//this.update_request_data_with_form(paymentDataRequest);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
|
@ -256,6 +255,14 @@ class ApplepayButton {
|
||||||
return paymentDataRequest
|
return paymentDataRequest
|
||||||
}
|
}
|
||||||
|
|
||||||
|
refreshContextData() {
|
||||||
|
switch (this.context) {
|
||||||
|
case 'product':
|
||||||
|
// Refresh product data that makes the price change.
|
||||||
|
this.productQuantity = document.querySelector('input.qty').value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//------------------------
|
//------------------------
|
||||||
// Payment process
|
// Payment process
|
||||||
|
@ -375,6 +382,8 @@ class ApplepayButton {
|
||||||
getShippingContactData(event) {
|
getShippingContactData(event) {
|
||||||
const product_id = this.buttonConfig.product.id;
|
const product_id = this.buttonConfig.product.id;
|
||||||
|
|
||||||
|
this.refreshContextData();
|
||||||
|
|
||||||
switch (this.context) {
|
switch (this.context) {
|
||||||
case 'product':
|
case 'product':
|
||||||
return {
|
return {
|
||||||
|
@ -402,6 +411,9 @@ class ApplepayButton {
|
||||||
}
|
}
|
||||||
getShippingMethodData(event) {
|
getShippingMethodData(event) {
|
||||||
const product_id = this.buttonConfig.product.id;
|
const product_id = this.buttonConfig.product.id;
|
||||||
|
|
||||||
|
this.refreshContextData();
|
||||||
|
|
||||||
switch (this.context) {
|
switch (this.context) {
|
||||||
case 'product': return {
|
case 'product': return {
|
||||||
action: 'ppcp_update_shipping_method',
|
action: 'ppcp_update_shipping_method',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue