cancel
Showing results for 
Search instead for 
Did you mean: 

How to restrict user to add maximum of 99 of any single product to cart.

Former Member
0 Kudos

As a User, I should be able to add a minimum of 1 and a maximum of 99 of any single product to cart. How to add this functionality.

Accepted Solutions (1)

Accepted Solutions (1)

former_member620692
Active Contributor
0 Kudos

You can write your validation by overriding validateAddToCart method of DefaultCommerceAddToCartStrategy.

Answers (3)

Answers (3)

harsh_mudgal
Explorer
0 Kudos

Overwrite getForceInStockMaxQuantity method of DefaultAbstractCommerceCartStrategy and set it to 99. That will reset the quantity to 99 if user enter anything greater than 99.

Former Member
0 Kudos

If I am not wrong, There will be an attributes called minOrderQuantity and maxOrderQuantity at Product Level. I think your requirement can be fulfilled by setting the values as 1 and 99 to those attributes. If it is fulfilled, you can run a batch script to update for all the products in your catalog.

VinayKumarS
Active Contributor
0 Kudos

there is no out of the box feature for this. write an interceptor and call while add or updating the cart. if more than 99 products added then display the appropriate message on the cart page.