Restrictions for Shipment Method


  • Default avatar
    flavio_giovanni    
     24 days ago
    0

    Hi Seyi, I wanted to create a coupon limited to the willful Delivery and not for the PickUp Point (Shipment methods).

    By going to the Coupon tab, in the "Other Restrictions" section, the Payment Method field is available but not the Shipment Method.

    Would it be possible to insert a filter also for Shipping Methods?

    Thanks!

  • Your avatar
    seyi    
     23 days ago
    0

    Hello,

    You would have to use a combination coupon:

    Coupon A:  your product discount
    Coupon B: shipping coupon, set value to 0
    Coupon C: combination coupon where you add coupons A and B and set process type to 'only if all apply'

  • Default avatar
    flavio_giovanni    
     23 days ago
    0

    Thanks Seyi, I created the 3 coupons as you recommended, now if I try to insert the COUPON C (Combination), I receive the following message:

    Coupon code not found. Please try again. 

    Why?

    Thanks a lot.

  • Your avatar
    seyi    
     23 days ago
    0

    Not sure, does the cart qualify for the coupon, is the correct shipping method selected?

    You could go to awocoupon > configuration > error messages, click debug and save then try the coupon again in the front end.  The error messages do not work well for a combination coupon, but you an try coupon a and coupon b individually to see where it is failing.
  • Default avatar
    flavio_giovanni    
     23 days ago
    0

    This is the error message: 
    HASSLEFREE5: No record, unpublished or expired


    I created a simple Product COUPON: Code HASSLEFREE, Published, Value 10%

    I created a second Shipping COUPON B: Code NOPICKUP, Published, Value 0, Shipping Exclude "PickUp Point"
    I created a third Combination COUPON C: Code HASSLEFREE5, Published, Only if ALL apply, Coupon A/B Include, without Other Restrictions


    If I insert Coupon A, 10% is applied to all purchases, if I insert Coupon C, I receive the error indicated above.

  • Your avatar
    seyi    
     23 days ago
    0

    And what happens when you try to use the coupon code NOPICKUP?
  • Default avatar
    flavio_giovanni    
     23 days ago  last edited 23 days ago
    0

    If I respect the conditions of Shipping COUPON B, inserting the Code NOPICKUP, I receive the message: Discount Coupon successfully added
  • Your avatar
    seyi    
     23 days ago
    0

    Ok, but is it actually added to the cart?  In awocoupon > configuration, do you have 'Enable zero value coupon' set to 'yes'?
  • Default avatar
    flavio_giovanni    
     22 days ago  last edited 22 days ago
    0

    Yes, I just set the 'Enable zero value coupon' field on YES, but if I continue to enter the Combination COUPON C, the code always works, whatever shipping method I choose.


    Product Coupon AShipping Coupon BCombination Coupon C

  • Your avatar
    seyi    
     22 days ago
    0

    Ok, shipping coupons work a little differently.  When you add a shipping coupon to the cart, even if the valid shipping method is not in the cart, it is accepted and no discount is given to shipping.  Due to various things, including onepage extensions and automatic shipping selections it has to work this way.  But in the case where the value of the shipping coupon is 0, it is not necessary to keep it in the cart.  So here is some code you can add that should fix this:
    in the file www/administrator/components/com_awocoupon/awocoupon/library/class-awocoupon-library-discount.php, around the line 5064 is this:
    <?php
                    
    return $this->return_false'errShippingInclList' );
    ?>

    Right before that add this:
    <?php
                    $val 
    round$coupon_row->coupon_value$this->round );
                    if( empty( $val )&& empty( $coupon_row->coupon_value_def ) ) {
                        return 'errShippingInclList';
                    }
    ?>

    And around the line 5080 is this
    <?php
                    
    return $this->return_false'errShippingExclList' );
    ?>

    Right before that add this:
    <?php
                    $val 
    round$coupon_row->coupon_value$this->round );
                    if( empty( $val )&& empty( $coupon_row->coupon_value_def ) ) {
                        return 'errShippingExclList';
                    }
    ?>

    Should work fine after that.
  • Default avatar
    flavio_giovanni    
     22 days ago
    0

    Thanks dear, you really are number one, now Combination Coupon C works perfectly.

    However it would not be bad for a faster use, inserting it as an exclusion, directly among the restrictions of the product coupon, what do you think?
    It is only a piece of advice, but the important thing to have solved.

    Thanks again and see you soon for a new project ;)