Automatic coupon not following the 'ONLY ONE' coupon rule


  • Default avatar
    paypal4    
     3 years ago
    0

    Hi Seyi,

    I have a problem with automatic applied coupons in combination with the setting that only 1 coupon is allowed.

    We have several pairs of two products (call it a product A and B) that have a buy x get y coupon that is automatcally applied when both products are put in the cart. This works good.

    However, we also have configured that only 1 coupon may be used to prevent people getting a double discount.

    Now, when someone puts product A in the cart, they can enter a coupon manually. Then when they enter product B, because the automatic applied coupon is also applied, because at that time product A and B are both in the cart. Now they get a double discount.

    Either the manually entered coupon OR the automatically applied coupon should be accepted. Not both.

    Can this be fixed so that the automatic applied coupons follow the 'ONLY ONE' rule too?

    Thank you,
    Kind regards,

    Maurice
  • Your avatar
    seyi    
     3 years ago
    0

    Hi Maurice,

    The automatic discounts are processed as though they are specials running in your store and are not counted within the number of allowed coupons.

    You can manually update your code to count it if you like.
    in www/administrator/components/com_awocoupon/helpers/estore/estorecouponhandler.php, around line 234 is this:

    <?php
            
    if(!empty($auto_code))  {
                foreach(
    $coupon_awo_entered_coupon_ids as $k=>$r) {
                    if(
                        (
    $iscaseSensitive && trim($auto_code->coupon_code)==$r)
                    ||    (!
    $iscaseSensitive && strtolower(trim($auto_code->coupon_code))==strtolower($r))
                
                    ) { 
                        unset(
    $coupon_awo_entered_coupon_ids[$k]);
                        break;
                    }
                }
            }
    ?>


    Disable the if statement, like this:
    <?php
            
    //if(!empty($auto_code))  {
            
    if(1!=1) {
    ?>


    That will add automatic coupons into your count
  • Default avatar
    paypal4    
     3 years ago
    0

    Hi Seyi,

    Thanks, I'll do that. Will this be overwritten with any future update?

    Maurice
  • Your avatar
    seyi    
     3 years ago
    0

    It will
  • Your avatar
    seyi    
     3 years ago
    0

    The ability to fully control number of:
    - automatic discounts
    - coupons
    - gift certificates

    has been added in the latest version, 2.2.3.