3

I would like to if order is above x amount then free shipping otherwise need to charge x amount.

In Free Shipping i already set X amount. In Flat Rate i set X amount.

But in frontend if order is above x amount then it display both Free Shipping & Flat Rate.

What i need if order if above X amount then it display only free shipping otherwise flat rate.

test
  • 432
  • 5
  • 13

5 Answers5

6

Here is a simple idea, return Flat Rate only if Subtotal amount is less then Free shipping

// catalog/model/shipping/flat.php

replace

 return $method_data;

with

if ($this->cart->getSubTotal() < $this->config->get('free_total')) {
    return $method_data;
  }
Ramesh
  • 1,324
  • 1
  • 12
  • 18
  • Hello, I tried to do this on my opencart but whenever I check out, it shows warning such as: no shipping fee select and so on. Please help. – Reu Roo Jun 13 '16 at 19:40
3

If you use OC 3.0.2 version, you should... in file: //catalog/model/extension/shipping/flat.php find:

return $method_data;    

and replace with:

 if ($this->cart->getSubTotal() < $this->config->get('shipping_free_total')) {
    return $method_data;
  } elseif (!$this->config->get('shipping_free_total')) {
        return $method_data;
  }

This modification will disable flat shipping method when cart total will be reached which is set in free shipping method. So two shipping methods must be enabled. Flat rate shipping method and Free shipping method. Flat shipping will work even if you disable Free shipping. After you make this changes refresh modifications and clear cache in admin dashboard.

K. B.
  • 943
  • 2
  • 7
  • 20
1

You gotta enable both the shipping extensions in order to function without error. Please enable both Free Shipping and Flat Rate modules in admin panel.

0

I did it

Go to these steps

  1. Go to the Extensions
  2. Select Extension type -- Shipping
  3. Install Flat Rate and Enable it
  4. Give your FLAT rate Cost (The cost that you want to charge for your shipping)
  5. Again Install Free Shipping and Enable it
  6. You will find Total Field (The total amount that you want to keep)
  7. Save it
  8. Go to your project folder/catalog/model/extension/shipping/flat.php
  9. You will get return $method_data;
  10. Replace with this code :

    if ($this->cart->getSubTotal() < $this->config->get('shipping_free_total')) { return $method_data; }

  11. Check this getSubTotal() function is available or not in your Project folder

    system/library/cart/cart.php

It will be available 12. Again check this shipping_free_total field name by Going back again to the Free shipping extension and in Total field Do inspect and get the Field Name

I am using 3.x so my Total field name is shipping_free_total, i am not sure but it may be vary this field name according to the opencart version.

Check it. You are done. Thanks.

Y. Joy Ch. Singha
  • 2,183
  • 18
  • 20
  • Both are working fine but I'm facing issue with unchecked button when free shipping is available.Getting error "Warning: No Shipping options are available. Please contact us for assistance!".Any solutions? – think_user Sep 03 '20 at 10:28
0

This extension "Display Customized Message" can help you show it easily within seconds. Link below https://www.opencart.com/index.php?route=marketplace/extension/info&extension_id=22785

So if you want to show the amount left to qualify for free shipping. This is one of the best extensions for that. As it works automatically. Also once yo