USPS Plugin Produces Free Shipping Over $50 | Awo Coupon Buy One Get One Should not Produce Free Shipping Less than $50


  • Default avatar
    peter15    
     5 years ago
    0

    Hello,

    I have set up my USPS Virtuemart plugin to give free shipping over $50. This is the default for orders over $50 that do not use a coupon.

    I have set up a Awocoupon for Buy One Get One Free. One customer purchased products whose intial value exceeded $50. However, when the coupon is applied the value becomes less than $50. Free shipping is automatically applied as conditional by my USPS plugin, I believe. I don't want this since I am already discounting product, and I still have to pay for shipping.


    My question is..

    Does AwoCoupon allow to discounts to be taken after shipping is applied?

    This issue may not pertain to AwoCoupon Pro, but I was wondering if someone can guide me on how to accomplish this.

    My other option would be to remove free shipping all together.

    Thank you!
  • Your avatar
    seyi    
     5 years ago
    0

    Hello,

    The free shipping is hanlded within your usps plugin, so you would have to make the modifications there. It is looking at the saleprice, and not the saleprice my discounts.

    For example, in the shipping plugin weight_countries, in function getCosts, this is the logic to determine free shipping:
    <?php
            
    if ($method->free_shipment && $cart_prices['salesPrice'] >= $method->free_shipment) {
    ?>


    This does not take into account coupons, I would change it to the below, (code borrowed from payment plugin standard)
    <?php
            $amount 
    $this->getCartAmount($cart_prices);
            if (
    $method->free_shipment && $amount >= $method->free_shipment) {
    ?>


    And that should do it.
  • Your avatar
    stefan_mario    
     a year ago
    0

    Seyi, I am a noob sorry. Where do I change this?
  • Your avatar
    seyi    
     a year ago
    0

    Directly in the shipping method file:

    www/plugins/vmshipment/[shipping_method]/[shipping_method].php
  • Your avatar
    stefan_mario    
     a year ago
    0

    I have added that to weight_countries.php in the appropriate line, but then it shows me a syntax error (unexpected ";")
  • Your avatar
    seyi    
     a year ago  last edited a year ago
    0

    It should not product an error.  Did you include the php tags <\?php and ?>  If so remove them.
  • Default avatar
    jan448    
     9 months ago
    0

    Thanks for your job, but unfortunately i cannot reproduce the fix.

    If i change the strings as you wrote, my total cart is updated ONLY with the shipping cost. So there's something wrong with this hack.

    How to let AwoCoupon work apart from the shipping costs?

    I need the shipping costs to be excluded from the discounts.

    Thanks
  • Your avatar
    seyi    
     9 months ago
    0

    Hello,

    Try this instead:

    Again, find the line in the shipping method that would read something like this:

    <?php
            
    if ($method->free_shipment && $cart_prices['salesPrice'] >= $method->free_shipment) {
    ?>

    And replace it with this:
    <?php
            $amount 
    $cart_prices['salesPrice'];
            if ( function_exists'AC' ) ) {
                $awosess AC()->storediscount->get_coupon_session();
                if ( ! empty( $awosess ) ) {
                    $amount -= ( $awosess->product_discount $awosess->shipping_discount );
                }
            }
            if ($method->free_shipment && $amount >= $method->free_shipment) {
    ?>