Menu Close

How do you dynamically change the coupon discount percentage by product category?

default

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?

View Source
Posted in WooCommerce, WooCommerce Questions & Answers