Fix product page orders considering shipping costs

This commit is contained in:
Pedro Silva 2023-10-30 14:27:42 +00:00
parent 2b9ac48616
commit 5d885809f7
No known key found for this signature in database
GPG key ID: E2EE20C0669D24B3
6 changed files with 34 additions and 15 deletions

View file

@ -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;

View file

@ -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;