Repository Forums Support WooCommerce Extended Coupon Features PRO Auto-apply not working on negative values

Topic Resolution: Resolved
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #319
    Kenneth A Gagne
    Participant

    I have a strange situation where I want the price to go UP — so I’ve made the coupon worth -20 and have set it to trigger if three particular items are in the customer’s cart. However, I can’t get it to auto-apply! If the customer manually applies the coupon code, it works fine. If I change the coupon’s value to make the cart price go down, it auto-applies fine. But auto-applying a negative coupon won’t work. Is this a bug?

    -Ken

    #321
    Soft79
    Keymaster

    Well not a bug, just an unexpected feature 😉

    for now, just edit line 387 of wjecf-autocoupon.php:

    replace

    if ( $coupon->get_discount_amount( $cart_item['data']->price, $cart_item ) > 0 ) {

    with

    if ( $coupon->get_discount_amount( $cart_item['data']->price, $cart_item ) <> 0 ) {

    I will fix this in a future version.

    #324
    Kenneth A Gagne
    Participant

    Yes! I made the change you suggested, as well as on line 269 of the pro edition, and now the negative coupon works perfectly.

    I realize that this is an unusual use of a coupon, and there are probably better ways to do what I’m trying to accomplish. I appreciate you not objecting to that and instead offering this easy fix. Thank you very much.

    -Ken

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.