mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-04 08:47:23 +08:00
Fix product page orders considering shipping costs
This commit is contained in:
parent
2b9ac48616
commit
5d885809f7
6 changed files with 34 additions and 15 deletions
|
@ -68,6 +68,13 @@ class BaseHandler {
|
|||
return onApproveHandler(data, actions);
|
||||
}
|
||||
|
||||
errorHandler() {
|
||||
return new ErrorHandler(
|
||||
this.ppcpConfig.labels.error.generic,
|
||||
document.querySelector('.woocommerce-notices-wrapper')
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default BaseHandler;
|
||||
|
|
|
@ -49,19 +49,14 @@ class SingleProductHandler extends BaseHandler {
|
|||
}
|
||||
|
||||
createOrder() {
|
||||
return this.actionHandler().configuration().createOrder();
|
||||
}
|
||||
|
||||
products() {
|
||||
return this.actionHandler().getProducts();
|
||||
return this.actionHandler().configuration().createOrder(null, null, {
|
||||
'updateCartOptions': {
|
||||
'keepShipping': true
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
actionHandler() {
|
||||
const errorHandler = new ErrorHandler(
|
||||
this.ppcpConfig.labels.error.generic,
|
||||
document.querySelector('.woocommerce-notices-wrapper')
|
||||
);
|
||||
|
||||
return new SingleProductActionHandler(
|
||||
this.ppcpConfig,
|
||||
new UpdateCart(
|
||||
|
@ -69,10 +64,13 @@ class SingleProductHandler extends BaseHandler {
|
|||
this.ppcpConfig.ajax.change_cart.nonce,
|
||||
),
|
||||
document.querySelector('form.cart'),
|
||||
errorHandler,
|
||||
this.errorHandler(),
|
||||
);
|
||||
}
|
||||
|
||||
products() {
|
||||
return this.actionHandler().getProducts();
|
||||
}
|
||||
}
|
||||
|
||||
export default SingleProductHandler;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue