0

I have a few special shopping cart rules which customer can apply through an activation URL. This is working fine, but I need to be able to display a message if the customer removes a product or changes the quantity in a way that the shopping cart rule is no longer valid. What's the best way of achieving this? Is there an event to listen to?

Steps should be as follows

  1. Customer gets an activation link, which will add the products with quantity needed to the cart and apply the shopping cart price rule.

  2. If the customer changes the quantity or remove a product, a message needs to show letting the customer know the Promotion Code is no longer valid or something similar because the X product is removed etc.

1 Answer 1

1

Check this event: checkout_cart_update_items_after, if you do your logic every time this is dispatched, you can add a session message for the customer that it's not valid anymore.

Then you'd have to set some kind of flag somewhere that the cart in this combination is not applicable for the rule. For example you could make your own table and save a customer in combination with a bool yes/no and the name of the rule (for example userid, specialruleid, no to prevent him from using that rule).

The only thing that's left is to override the class where the shopping cart rules are applied and add a condition that it's only applied if your resource for your table doesn't say otherwise.


Hope this makes sense, feel free to ask if I'm unclear.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.