Repository › Forums › Support › WooCommerce Extended Coupon Features PRO › How to create coupon with multiple discount rules
- This topic has 5 replies, 2 voices, and was last updated 4 months, 2 weeks ago by Kit Shum.
- AuthorPosts
- April 21, 2026 at 9:26 am #21563Kit ShumParticipant
Hi,
I would like to know if there’s any way to create a coupon with multiple discount rules. Currently I need to have the following discount rules:
Cart minimum amount $1000 = 5% off all items on cart (except discount items and category B items)
Cart minimum amount $2000 = 10% off all items on cart (except discount items and category B items)
Cart minimum amount $3000 = 15% off all items on cart (except discount items and category B items)
Cart minimum amount $4000 = 20% off all items on cart (except discount items and category B items)
Cart minimum amount $5000 = 20% off all items on cart (except discount items and category B items)But to achieve just this alone I had to create 5 separate coupons (we also have another 30 separate coupon rules for our other discounts for the month). Is there any way to group the above discount rules into 1 coupon?
Thank you.
April 22, 2026 at 8:38 pm #21565Soft79KeymasterThat would need a custom php snippet. Create a 5% discount coupon which excludes discount items and category B items. Add the following snippet to your child theme’s functions.php, replace THE_COUPON_CODE with the actual coupon code.
add_filter('woocommerce_coupon_get_amount', 'custom_tiered_coupon_amount', 10, 2); function custom_tiered_coupon_amount($amount, $coupon) { if (is_admin() && !defined('DOING_AJAX')) return $amount; if ($coupon->get_code() !== 'THE_COUPON_CODE') { return $amount; } $cart_total = WC()->cart->get_subtotal(); if ($cart_total >= 5000) { $amount = 20; } elseif ($cart_total >= 4000) { $amount = 20; } elseif ($cart_total >= 3000) { $amount = 15; } elseif ($cart_total >= 2000) { $amount = 10; } elseif ($cart_total >= 1000) { $amount = 5; } else { $amount = 0; } return $amount; }That should do the trick. I didn’t test it though.
April 24, 2026 at 11:32 am #21567Kit ShumParticipantHi,
Many thanks that did the trick! One last question what about items based on the quantity purchased?
(e.g.)
buy 2 category A items, those items get 5% off
buy 4 category A items, those items get 10% off
buy 6 category A items, those items get 15% off
etc etc….Would you be able to kindly provide the custom php snippet for this scenario? Thank you!
April 27, 2026 at 10:09 pm #21569Soft79KeymasterI will get back to this…
April 28, 2026 at 7:35 pm #21570Soft79KeymasterThat may work with a similar script. Create a 5% discount coupon for items in category A and replace the previous snippet with the following snippet.
Replace
COUPON_CODE_Bwith the category B coupon code and replaceCOUPON_COUDE_Awith the category A coupon code.add_filter( 'woocommerce_coupon_get_amount', function ($amount, $coupon) { if ($coupon->get_code() !== 'COUPON_CODE_B') return $amount; if (is_admin() && !defined('DOING_AJAX')) return $amount; $cart_total = WC()->cart->get_subtotal(); if ($cart_total >= 5000) return 20; if ($cart_total >= 4000) return 20; if ($cart_total >= 3000) return 15; if ($cart_total >= 2000) return 10; if ($cart_total >= 1000) return 5; return 0; }, 10, 2 ); add_filter( 'woocommerce_coupon_get_amount', function ($amount, $coupon) { if ($coupon->get_code() !== 'COUPON_CODE_A') return $amount; if (is_admin() && !defined('DOING_AJAX')) return $amount; if (!function_exists('WJECF')) return $amount; $n_items = WJECF()->get_quantity_of_matching_products(); if ($n_items >= 6) return 15; if ($n_items >= 4) return 10; if ($n_items >= 2) return 5; return 0; }, 10, 2 );April 30, 2026 at 4:14 pm #21571Kit ShumParticipantHi,
Thank you!
- AuthorPosts
- You must be logged in to reply to this topic.