on 12-23-2016 2:18 PM
Hi Folks,
I am working on the custom promotion and i have a requirement to remove/undo the promotion applied from a cart entry when the user requested.
I found we can undo the promotions using cleanupCart method in promotionmanager and in inside cleanupCart method it is calling deleteStoredPromotionResultsmethod.
Can anyone share your suggestions how to proceed?
Thanks Aruna
I guess I'm late to the party but assuming you were talking about the legacy promotion engine, you could do something like this:
boolean requiresRecalculate = false;
Set<PromotionResultModel> promotionResultModels = cartModel.getAllPromotionResults();
for(PromotionResultModel promotionResultModel : promotionResultModels) {
PromotionResult promotionResult = modelService.toPersistenceLayer(promotionResultModel);
requiresRecalculate |= promotionResult.undo();
}
customCartService.recalculateCart();
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.