How to Set Maximum Qty Allowed in Shopping Cart in Magento 2
Inventory management is undoubtedly one of the most important factors where merchants pay their attention.
A merchant has to manage inventory properly to satisfy their customers. If a customer purchases the same product on a large quantity, the product may be sold out and no other customers will be able to purchase that product.
If other customers are not able to buy a product even in a single quantity or in a small quantity, it drastically reduces the shopping experience to customers.
The configuration of maximum and minimum quantity based on customer groups can be done with Meetanshi’s Magento 2 Limit Cart Quantity extension.
By setting up the maximum quantity allowed to be sold by a single customer, the Magento 2 store owners can restrict customers from buying a product on a large quantity.
The default Magento 2 has the facility to do so. Improve the sales management using the steps given below in your Magento 2 store:
Steps to Set Maximum Qty Allowed in Shopping Cart in Magento 2:
- Login to Magento 2 admin panel
- Navigate to Stores > Settings > Configuration
- Select Inventory under Catalog section
- Expand Product Stock Options section
- Set the maximum quantity as per your business requirement in Maximum Qty Allowed in Shopping Cart
- Click Save Config
Here, I have set 15 as a maximum quantity allowed in the shopping cart. Therefore, when customers will add more quantity than 15, the error message will be shown saying that “The maximum you may purchase is 15”.
The below figure shows the error message to restrict the customer to add the products to the cart.
That’s it.
If you have queries regarding this tutorial, feel free to ask in the Comment section below.
I would be happy to help you.
Do consider sharing this post with Magento 2 community via social media.
Thank you.
Jignesh Parmar
An expert in his field, Jignesh is the team leader at Meetanshi and a certified Magento developer. His passion for Magento has inspired others in the team too. Apart from work, he is a cricket lover.
2 Comments
Please check
Hello,
We’ve implemented the above code and it is perfectly working.
Thank You.