How to set the coupon discount based on WooCommerce product category?

We need to create a coupon that will offer different discounts for each product category, something like what this plugin does: https://www.flycart.org/blog/wordpress/how-to-use-one-coupon-code-for-multiple-discounts-in-woocommerce

So what we need is to have a single coupon that offers the client:
– x% discount for the Product Category A
– y% discount for the Product Category B

This has to happen even when we have product from both categories in the cart.

If there are both cats in the cart then each cat has to have its own discount percentage applied. The module above manages to do that.

Is there a code snippet that can achieve this, or it’s better to go and by the plugin?

Related content

Rodolfo Melogli

Business Bloomer Founder

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza. Follow @rmelogli

1 thought on “How to set the coupon discount based on WooCommerce product category?

  1. Getting a custom snippet coded will probably cost you more than the plugin itself. I’d try the plugin first, and if it works then that’s a better choice in my opinion

Reply

Your email address will not be published. Required fields are marked *