Tips, Tutorials, SEO, WordPress, Joomla, Web Design

Posts Tagged Under: Woocommerce product per category

woocommerce only one product per category in the cart 800x300 - WooCommerce allow only 1 product per category

WooCommerce allow only 1 product per category

This quick snippet can prevent your visitors from adding more than one (or pre-defined no.) product from a specific category to their cart. This PHP code snippet should go in your theme’s functions.php file.

// Allow only one(or pre-defined) product per category in the cart
add_filter( 'woocommerce_add_to_cart_validation', 'allowed_quantity_per_category_in_the_cart', 10, 2

Read More