on 2019 Jan 25 4:14 AM
Hi,
I'm currently working on a project (v1808) that requires a custom promotion Action. This action, once fired will modify the cart with a certain value. The problem we are facing is that the undo method is not being called when the promotion condition has been removed. The apply is being set, so we know the promotion action has been setup correctly, but undo never gets called.
I've set this up two ways, one with a coupon code, and one with an order total. Neither removing the coupon code, or setting the order total below the threshold, trigger the undo method.
Is there a step missing? I followed the trail in: https://help.hybris.com/1808/hcd/235755743eaf4da2aec5ac1352f93674.html#loio235755743eaf4da2aec5ac135...
@Override
public List<? extends ItemModel> apply(final AbstractRuleActionRAO action)
{
...
order.setInStockFreeShippingThreshold(orderThresholdAction.getThreshold());
getModelService().saveAll(promoResult, order);
getModelService().refresh(order);
return Collections.singletonList(promoResult);
}
@Override
public void undo(final ItemModel item)
{
LOG.error("test!");
if (item instanceof RuleBasedOrderThresholdActionModel)
{
final RuleBasedOrderThresholdActionModel action = (RuleBasedOrderThresholdActionModel) item;
undoInternal(action);
}
}
@Override
protected AbstractOrderModel undoInternal(final RuleBasedOrderThresholdActionModel action)
{
final AbstractOrderModel order = super.undoInternal(action);
order.setInStockFreeShippingThreshold(null);
getModelService().save(order);
getModelService().refresh(order);
return order;
}
Request clarification before answering.
| User | Count |
|---|---|
| 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.