You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When updating basket (useShopperBasketsMutation('updateBasket') of commerce-sdk) with a custom parameter in the query it seems that the cache is not in invalidated data.
This causes the basket object not to be updated with the data coming from the PATCH basket.
Steps To Reproduce
1 - Create hook to update an attribute in the basket
function basketAfterPATCH(basket, basketInput) {
try {
if (basket && basketInput) {
const basketRequestHelper = require('*/cartridge/scripts/helpers/basketRequestHelper');
const { updatePrices } = basketRequestHelper.getPatchBasketQueryParameters();
if (updatePrices) {
basket.getProductLineItems().toArray().forEach((productLineItem) => {
productLineItem.setPriceValue(productLineItem.getPriceValue() - 1);
});
}
}
basketCalculationHelpers.calculateTotals(basket);
} catch (e) {
return new Status(Status.ERROR);
}
return new Status(Status.OK);
}
Summary
When updating basket (
useShopperBasketsMutation('updateBasket')
of commerce-sdk) with a custom parameter in the query it seems that the cache is not in invalidated data.This causes the basket object not to be updated with the data coming from the PATCH basket.
Steps To Reproduce
1 - Create hook to update an attribute in the basket
2 - Update the basket
Expected result
I'm supposed to have my basket object updated with the actual values
Actual result
My basket has been well updated but not the cache basket object.
I've test without the custom parameter and everything is working well.
System Information (as applicable)
Node version: 18.17
@salesforce/retail-react-app: 2.4.0
The text was updated successfully, but these errors were encountered: