Learn in this tutorial how to limit to only one the number of products a user can add to WooCommerce cart using code.
If you are using WooCommerce in some cases you may want to limit the number of items that can be added to the cart.
For example, on a website where you only sell one product or subscription, where it doesn’t make sense to have more than one product in the cart at a time.
Interested in having control over this? Here’s how to do it.
Snippet to limit the WooCommerce cart to a single product
Add the following code at the end of functions.php or in your functionality plugin:
To see this and another 1097 code snippets of this website, login or subscribe here.
It’s as simple as that.
In this case, the user will only be able to add one product to WooCommerce cart.
Conclusions
Do you want to prevent customers from adding more than one product to WooCommerce cart? Now you know how to do it easily with code.
If you have any question, please leave it in the comments. And if you want to give me a suggestion for future snippets, please send it through the contact form.
Benefits of being a subscriber. 🙂