I am creating for a client a magento site to sell health and beauty products. Here is my issue.

Some of the products being sold by law are restricted on the amount you can sell in one purchase. for instance....

The maximum amount of restricted items allowed in the cart at one time is 2.

so you could have 2 packets of Parecetamol but no Asprin or 1 packet of paracetamol and 1 packet of Aspirin.

This is now the new law across the European Community so will be a very sort after function.

I am looking for a solution to this.


Magento has a Rule object with validation possibilities. Its primary consumer at the moment is the Mage/Salesrule module, which validates promotion restrictions, including a maximum amount of items.

It should be a good starting point for you to base those restrictions on.

Edit: In this answer I've used an observer to properly verify the quantity. It was a bit too much work for a answer on here to fully implement as a rule, but it can be done.

|improve this answer|||||
  • I'm assuming you're referring to the shopping cart rule feature. I'm not sure if that helps the OP? The cart rule is to apply discounts. As far as I know, it does not have the functionality to restrict product quantities. – musicliftsme Mar 11 '15 at 20:03
  • @musicliftsme You're gonna have to program something. And the Mage/Rule object is the way to apply validation rules to an abstract set of conditions. You can indeed use it to enforce quantity rules. I've posted that a few weeks ago here and I'll see in the morning if I can find it again and link it. – Melvyn Mar 11 '15 at 23:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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