free shipping


  • Default avatar
    JOMAISONJO    
     2 months ago
    0

    hi

    I would like to automatically apply a free shipping coupon when a customer reaches 150 euros in an order.

    If I do that with Virtuemart, if a customer apply a 10% coupon discount in an order whose total is 150 euros,

    coupon is applied, free shipping as well, but the order total is no longer 150 but 135 euros.


    How can I apply free shipping on conditions after the discounts are applied?

    thanks


  • Your avatar
    seyi    
     2 months ago
    0

    Hello,

    You can keep using the virtuemart free shipping option in the shipping method.  You would just need to modify the shipping method you are using a little:

  • Default avatar
    JOMAISONJO    
     2 months ago
    0

    hi which file exactly? can you provide the full path please?
  • Your avatar
    seyi    
     2 months ago
    0

    It depends on your shipping method.  If you are using standard then

    www/plugins/vmshipment/weight_countries/weight_countries.php

  • Default avatar
    JOMAISONJO    
     2 months ago
    0

    Hi

    I've tried and the code modified is


    function getCosts (VirtueMartCart $cart, $method, $cart_prices) {


    $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 && $cart_prices['salesPrice'] >= $method->free_shipment) {

    return 0.0;

    } else {

    if(empty($method->shipment_cost)) $method->shipment_cost = 0.0;

    if(empty($method->package_fee)) $method->package_fee = 0.0;

    return $method->shipment_cost + $method->package_fee;

    }

    }



    unfortunately it is not working as expected.

    Please advice

    thanks

  • Your avatar
    seyi    
     2 months ago
    0

    You did not make this change
    <?php
    <span style="white-space:pre;"></span>if ($method->free_shipment && $cart_prices['salesPrice'] >= $method->free_shipment) {
    ?>

    To
    <?php
    <span style="white-space:pre;"></span>if ($method->free_shipment && $amount >= $method->free_shipment) {
    ?>

  • Default avatar
    JOMAISONJO    
     2 months ago
    0

    thank you.

    indeed, it's now working with manual coupons.

    if I have an automatic coupon, instead, no.

    e.g. I have an automatic discount of 22euros, applied to a certain product only, when the order is at least 172 euros.

    coupon is automatically applied correctly but if I add another manual 10% coupon which brings the order total to less than 172 euros,

    the automatic coupon is still there.

    suggestions?

    thanks


  • Your avatar
    seyi    
     2 months ago
    0

    Hello,

    Cannot seem to produce this.  No matter the combination of automatic and normal coupons entered in the cart that the shipping costs still show correctly as long as it is above the free shipping amount after all awocoupon discounts.