Free shipping minimum order value


  • Default avatar
    robert85    
     9 years ago
    0

    Hi

    On our site we have a minimum order value of £20GBP for free delivery. When I create a coupon for 'Buy X Get Y' and set it up so that when a customer purchases Product A, Product B will be free.

    When the value of Product A & B are totaled, they exceed £20GBP and would be eligible for free delivery under normal circumstances. However, when the coupon is used that gives Product B for free, the total order is reduced to below £20. Despite this, the deliver fee for orders up to £20 is not being applied as it seems that the normal value before discount is being used by Virtuemart.

    I need the delivery fee to be applied in this case. Can you help?

    Kind regards!
  • Your avatar
    seyi    
     9 years ago
    0

    Hello,

    This depends on the shipping method you are using. And to get it working the way you want, you would need to alter the plugin of the shipping method you are using to give free shipping.

    Here is a post showing what to do:
    https://awodev.com/forum/awocoupon/help-section/usps-plugin-produces-free-shipping-over-50-awo-coupon-buy-one-get-one-s#comment-6874
  • Default avatar
    robert85    
     9 years ago
    0

    Thanks Seyi.. I will give that a try.

    Kind regards!
  • Default avatar
    robert85    
     9 years ago
    0

    Hi Seyi

    It has taken a while since for me to take your advice above with regards VM free shipping being applied AFTER any coupon discount. I tried it today - i.e. editing the code in the VM shipping plugin, and swapped the code as you suggested. Unfortunately, it does not work.

    For example - the site gives free shipping on orders over £20. I set up a coupon for £5 and added products to the total of £24.75. When the coupon was applied, the new total is £19.75, but VM did not apply the shipping cost (as normal for orders under £20 value).

    Hope you can help.
  • Your avatar
    seyi    
     9 years ago
    0

    Hello,

    Can you display the code you added and to what file?
  • Default avatar
    robert85    
     9 years ago
    0

    Replaced this:

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


    With this:

    <?php
            $amount 
    $this->getCartAmount($cart_prices);
            if (
    $method->free_shipment && $amount >= $method->free_shipment) {
    ?>
  • Your avatar
    seyi    
     9 years ago
    0

    Hello,

    Can you send the file you edited to the email on the contact us page please?
  • Default avatar
    robert85    
     9 years ago
    0

    Hi Seyi.. yes, I will do this shortly. We have actually decided to remove the free delivery altogether, so this isn't so important now - but I'd like to know the fix in any case.

    Thanks!
  • Your avatar
    seyi    
     9 years ago
    0

    Hello,

    Seems in that version of Virtuemart, 2.6.6, the coupon has not been calculated yet, so it is zero. The only way to get around this is to get the coupon data directly from AwoCoupon, so in same file change this

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


    to this
    <?php
            $amount 
    $cart_prices['salesPrice'];
            
    $coupon_session JFactory::getSession()->get('coupon''''awocoupon');
            if(!empty(
    $coupon_session)) {
                
    $coupon_session unserialize($coupon_session);
                
    $salespricecoupon round($coupon_session['product_discount'] + $coupon_session['shipping_discount'],2);
                
    $amount -= $salespricecoupon;
            }
            if (
    $method->free_shipment && $amount >= $method->free_shipment) {
    ?>
  • Default avatar
    robert85    
     9 years ago
    0

    Thanks Seyi! Greatly appreciate your help. I will give this a try.

    Kind regards!
  • Default avatar
    paolo13    
     7 years ago
    0

    greetings to everyone, the previous code in my case is not useful because I need the coupon discount to affect the price range; Example: I have a cost for the band 180 € (minimum order) - 300 € (maximum order) and one with freeshipping after 300 € (minimum order) the cart with the standard price is 310 € but discount removed drops 290 € and I would like to choose the configuration plugin for 180 € - 300 € how do I ?? For these situations, should you make a modified shipping plugin to match AWOcoupon since there are normal requirements your component should consider? for some of my clients who use awocoupon this thing is to be solved urgently how can i do it?
  • Your avatar
    seyi    
     7 years ago
    +1

    In function checkconditions, there is this code:

    <?php
                $orderamount_cond 
    $this->testRange($cart_prices['salesPrice'],$method,'orderamount_start','orderamount_stop','order amount');
    ?>


    try changing it to
    <?php
                $amount 
    $cart_prices['salesPrice'];
                $coupon_session JFactory::getSession()->get('coupon''''awocoupon');
                if(!empty($coupon_session)) {
                    $coupon_session unserialize($coupon_session);
                    $salespricecoupon round($coupon_session['product_discount'] + $coupon_session['shipping_discount'],2);
                    $amount -= $salespricecoupon;
                }
                $orderamount_cond $this->testRange($amount,$method,'orderamount_start','orderamount_stop','order amount');
    ?>


    I did not test the code, but it should work or at least send you in the right direction