Title: coupon application precedence
Last modified: August 24, 2016

---

# coupon application precedence

 *  Resolved [kc_webmaster](https://wordpress.org/support/users/kc_webmaster/)
 * (@kc_webmaster)
 * [11 years ago](https://wordpress.org/support/topic/coupon-application-precedence/)
 * I’ve stumbled across two odd behaviors when using product % discount, when combined
   with automatic cart % discount. The auto cart % discount also has minimum spend.
 * First off, I don’t get why the cart % discount is applied before the product %
   discount. There isn’t much sense to this order at all.
 * The weird behavior occurs if you have some products in your cart and apply product
   coupon code, continue shopping and then add another product where the product
   coupon applies. This flips the order.
 * To my logic, a cart discount of any sort should happen last. I need some convincing
   to think otherwise. Regardless the mixed behavior is problematic.
 * Any ideas???
 * [https://wordpress.org/plugins/woocommerce-auto-added-coupons/](https://wordpress.org/plugins/woocommerce-auto-added-coupons/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [Soft79](https://wordpress.org/support/users/josk79/)
 * (@josk79)
 * [11 years ago](https://wordpress.org/support/topic/coupon-application-precedence/#post-6111955)
 * You’re right it’s odd behaviour but this is the way WooCommerce works though.
   The WooCommerce support is the right place for you, as this doesn’t really has
   to do anything with my plugin.
 * But I can give you a hint anyway. Please try this in your theme’s functions.php:
 *     ```
       function my_coupon_sorter () {
       	global $woocommerce;
       	$cart = $woocommerce->cart;
       	sort( $cart->applied_coupons );
       }
   
       add_action( 'woocommerce_applied_coupon', 'my_coupon_sorter' );
       ```
   
 * This will sort the coupons alphabetically, but by changing this code you can 
   sort them any way you’d like.
 *  Thread Starter [kc_webmaster](https://wordpress.org/support/users/kc_webmaster/)
 * (@kc_webmaster)
 * [11 years ago](https://wordpress.org/support/topic/coupon-application-precedence/#post-6112016)
 * I did do some more testing and discovered WooCommerce seems to be the source 
   of the problem. I’ll open a ticket with Woo and see what they have to say. 😉
 * The suggested work-around seems promising. THX!
 *  Thread Starter [kc_webmaster](https://wordpress.org/support/users/kc_webmaster/)
 * (@kc_webmaster)
 * [11 years ago](https://wordpress.org/support/topic/coupon-application-precedence/#post-6112076)
 * It looks like sorting code worked. Brilliant!
 *  Plugin Author [Soft79](https://wordpress.org/support/users/josk79/)
 * (@josk79)
 * [11 years ago](https://wordpress.org/support/topic/coupon-application-precedence/#post-6112088)
 * Excellent, glad I could help. Please rate my plugin!
 *  [albertorv](https://wordpress.org/support/users/albertorv/)
 * (@albertorv)
 * [11 years ago](https://wordpress.org/support/topic/coupon-application-precedence/#post-6112164)
 * Hello josk79
 * it’s possible add a function to apply a discount on the “original price” and 
   not on the discounted price?
 * now The plugin applies the discounted price lowered, but but I need both functions
   for some products…
 * thanks so much, very good plugin!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘coupon application precedence’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce-auto-added-coupons/assets/icon-256x256.png?rev
   =3357537)
 * [Extended Coupon Features for WooCommerce FREE](https://wordpress.org/plugins/woocommerce-auto-added-coupons/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce-auto-added-coupons/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce-auto-added-coupons/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce-auto-added-coupons/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce-auto-added-coupons/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce-auto-added-coupons/reviews/)

## Tags

 * [precedence](https://wordpress.org/support/topic-tag/precedence/)

 * 5 replies
 * 3 participants
 * Last reply from: [albertorv](https://wordpress.org/support/users/albertorv/)
 * Last activity: [11 years ago](https://wordpress.org/support/topic/coupon-application-precedence/#post-6112164)
 * Status: resolved