VM Problem free shipping and coupon code


  • Default avatar
    sandra91    
     2 years ago
    0

    Hi, I know that it is a topic already covered but I have read the various posts, tested the indicated solutions without solving.

    The problem:
    If I have a product in the cart that costs € 140.00, then free shipping because the total amount exceeds € 120.00 and then I apply an AwoCoupon discount code of € 50, the total in the cart is correct € 90.00 but the shipment remains free.

    Can you help me?
    1.  vm 3.8.8
    2. AwoCoupon 3.6.0

    Thank you
  • Your avatar
    seyi    
     2 years ago
    0

  • Default avatar
    sandra91    
     2 years ago
    0

    Yes I have tried it but nothing changes.
  • Your avatar
    seyi    
     2 years ago
    0

    Did you add it to the right file?  What is the shipping method being used and what file did you add it to?  And how did you setup free shipping?
  • Default avatar
    sandra91    
     2 years ago
    0

    Thanks for the reply..

    The file is this:
    plugins/vmshipment/weight_countries/weight_countries.php
    (Then if I see that it works I duplicate the plugin and reinstall it with a different name so as not to have problems with the next vm upgrades)

    Modified line: 200

    commenting on this:
    //if ($ method-> free_shipment && $ cart_prices ['salesPrice']> = $ method-> free_shipment) {

    and adding:

    $ amount = $ cart_prices ['salesPrice'];
            if (function_exists ('AC')) {
                static $ awosess = null;
                if (empty ($ awosess)) {
                    $ awosess = AC () -> storediscount-> get_coupon_session ();
                }
                if (! empty ($ awosess)) {
                    $ amount - = ($ awosess-> product_discount + $ awosess-> shipping_discount);
                }
            }
            if ($ method-> free_shipment && $ amount> = $ method-> free_shipment) {

    ---
    for shipments I obviously use the VM Shipment plugin - By weight, ZIP and countries.

    I have created multiple shipping methods for countries with different minimum and maximum amounts and minimum amount for free shipping at 121.00 euros

    I use the VP One Page Checkout plugin as a shopping cart

  • Your avatar
    seyi    
     2 years ago
    0

    So you can try a different way of calculating the amount, the full code, from:

    <?php
            
    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;
            }
    ?>

    to
    <?php
            $amount 
    0;
            foreach ( $cart->products as $k => $row ) {
                $amount += $cart_prices$k ]['subtotal_with_tax'];
            }
            if ( function_exists('AC')) {
                static $awosess null;
                if ( empty( $awosess ) ) {
                    $awosess AC()->storediscount->get_coupon_session();
                }
                if (!empty($awosess)) {
                    $amount -= ($awosess->product_discount);
                }
            }
            if ($method->free_shipment && $amount >= $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;
            }
    ?>

    If that does not work, the code has to be debugged to see what is going on.

  • Default avatar
    sandra91    
     2 years ago
    0

    no it doesn't work, shipping remains free. Do you with the same VM version and VP cart encounter the same problem?