Merge trunk

This commit is contained in:
Emili Castells Guasch 2023-11-07 09:25:59 +01:00
commit aa1942b604
30 changed files with 589 additions and 48 deletions

View file

@ -143,7 +143,7 @@ class SingleProductActionHandler {
{
this.cartHelper = null;
return (data, actions) => {
return (data, actions, options = {}) => {
this.errorHandler.clear();
const onResolve = (purchase_units) => {
@ -178,7 +178,7 @@ class SingleProductActionHandler {
});
};
return this.updateCart.update(onResolve, this.getProducts());
return this.updateCart.update(onResolve, this.getProducts(), options.updateCartOptions || {});
};
}

View file

@ -11,9 +11,10 @@ class UpdateCart {
*
* @param onResolve
* @param {Product[]} products
* @param {Object} options
* @returns {Promise<unknown>}
*/
update(onResolve, products)
update(onResolve, products, options = {})
{
return new Promise((resolve, reject) => {
fetch(
@ -27,6 +28,7 @@ class UpdateCart {
body: JSON.stringify({
nonce: this.nonce,
products,
...options
})
}
).then(