Showing results for 
Search instead for 
Did you mean: 

Remove/Undo promotion

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

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();