Coupon applies $0


  • Default avatar
    eric63    
     8 months ago
    0

    I have a coupon that works when is used by a customer on the first order but on the next order the discount is set to $0. The coupon is set to have unlimited uses for all customers so I don't understand why it's being set to $0. A different customer that never used the coupon tested the coupon and it applied the correct amount. Any ideas why would it have this behavior?
  • Your avatar
    seyi    
     8 months ago
    0

    Hello,

    Would need more information.  How is the coupon setup? And in the orders the coupon was used in did you verify it should have given a discount?  Some images might be helpful.
  • Default avatar
    eric63    
     8 months ago
    0

    Coupon Settings: https://pasteboard.co/G6ZEJGr5hq72.jpg
    Coupon applied correctly: https://pasteboard.co/K0Q3pPjzt5Tp.jpg
    Coupon applied with $0: https://pasteboard.co/Qextr84nM21Z.jpg

    I've been doing some more testing. The problem seems to be connected to the shipping address but I'm not sure.
  • Default avatar
    eric63    
     8 months ago
    0

    A couple more things that I found out:
    -  the issue is only on the cart page. Adding the coupon in the checkout works ok.
    -  even though the coupon shows the message "Coupon code applied successfully" and the name of the coupon appears in the cart totals column with $0 it turns out that the coupon is not applied because I've tried listing all coupons using php and I'm getting an empty array. When I try a different coupon the array shows the coupon.
  • Your avatar
    seyi    
     7 months ago
    0

    Ok, will need to see if I can produce this locally.  What version of wordpress / woocommerce / awocoupon are you running?
  • Default avatar
    eric63    
     7 months ago
    0

    PHP 7.4, WordPress 6.3.1, WooCommerce 8.3.1, AwoCoupon 3.6.0.3
  • Your avatar
    seyi    
     7 months ago
    0

    The latest version of woocommerce is 8.0.3, is that what you meant?
  • Default avatar
    eric63    
     7 months ago
    0

    yes, it's 8.0.3.
  • Your avatar
    seyi    
     7 months ago
    0

    Ok, don't think I was able to produce your error.  I was able to produce a 0 discount, but it only happens if you have case sensitivity disabled in awocoupon config and the coupon you enter in the front end is not all the same case as the code entered in the backend.  The fix for this was to delete a line of code, specifically in the file
    \wp-content\plugins\awocoupon\helper\estore\woocommerce\class-awocoupon-helper-estore-woocommerce-discount.php, line 267:

    <?php
                    $code 
    $cart->applied_coupons$key ];
    ?>
    If that does not fix it, would need to debug it directly.  For that, please send me a private message with temp access.
  • Default avatar
    eric63    
     7 months ago  last edited 7 months ago
    0

    It did not fix it but I have more info about the issue. The issue is not related to the use of the coupon. I have disabled a plugin called TaxJar - Sales Tax Automation for WooCommerce version 4.1.5 and the problem is gone.

    To replicate the issue using any customer I just set the address in the cart with the location : United States, Fort Worth, TX 76112, click Update and the discount goes to zero and the coupon seems to be removed from the applied coupons array as well. If I switch the address to United States, Indianapolis, IN 46202 then the coupon is added back in the applied coupons array and also the discount is no longer zero. TaxJar plugin has to be also active.