How to Use Weight Based Shipping For Multiple Flat Rates

Written by in Tutorials on May 13, 2013  |  27 Comments

how-to-use-opencart-weight-based-shipping-for-multiple-flat-rates

Do you want a second (or third, or fourth) flat rate for your site’s shipping? OpenCart doesn’t include a shipping method that allows for multiple flat rates by default, but you can easily set up multiple flat shipping options using the built-in Weight Based Shipping extension.

1. In System > Localisation > Geo Zones, set up a duplicate geo zone for each flat rate that you want. For example, if you wanted these three shipping options available to the U.S.:

  • Standard: $5.00
  • Express: $12.00
  • Next-Day: $18.00

then you would create three geo zones all with United States selected as the country, named “Standard”, “Express”, and “Next-Day”.

how-to-use-weight-based-shipping-1

2. In Extensions > Shipping > Weight Based Shipping, create a rate for each geo zone with a rate (in the format Weight:Cost) like so:

RATE #1

  • Geo Zone: Standard
  • Rates: 999999:5.00

RATE #2

  • Geo Zone: Express
  • Rates: 999999:12.00

RATE #3

  • Geo Zone: Next-Day
  • Rates: 999999:18.00

Don’t forget to enable the extension as a whole in the “General” tab, and each geo zone in its own tab. If you have other geo zones for other purposes (such as the “USA” and “United Kingdom” geo zones in the example screenshot) then leave those disabled in their tabs. If you need a tax rate applied to the shipping costs, then select the Tax Class in the “General” tab.

how-to-use-weight-based-shipping-2

3. During checkout, each option will be presented to the customer on the “Delivery Method” step. They are ordered alphabetically by name, so if you need them in a particular order then you should name them accordingly.

how-to-use-weight-based-shipping-3

4. If you want to change the name of the shipping method heading, you can do so in /catalog/language/english/shipping/weight.php . If you want to remove the cart weight that is attached to each rate title, then you can make the following edit:

IN:
/catalog/model/shipping/weight.php

REPLACE:
$result['name'] . ' (' . $this->language->get('text_weight') . ' ' . $this->weight->format($weight, $this->config->get('config_weight_class_id')) . ')',

WITH:
$result['name']

And that’s it! Your OpenCart store now has multiple flat rate shipping options for your customer.

Tags: , , ,

About the Author

Johnathan Shaw has been working with OpenCart since 2009. He is the owner of Clear Thinking web development and runs OpenCartX, the curated OpenCart extension marketplace.

View all posts by

27 Comments on "How to Use Weight Based Shipping For Multiple Flat Rates"

  1. Johnathan August 18, 2016 at 4:06 pm · Reply

    Because shipping method choice comes *before* payment method choice in OpenCart, you’d need to restrict the payment method options based on the shipping method choice. If you want to restrict which payment methods appear based on the shipping method, you could use this extension:

    • Restrict Payment Methods (www.opencartx.com/restrict-payment-methods)

    Feel free to take a look at the screenshots and demo site, and if you’re interested let me know if you have any further questions at http://www.getclearthinking.com/contact

  2. Harsh August 18, 2016 at 5:49 am · Reply

    Jonathan , i used same but now on specific shipping i want to give cod then what to do

  3. Vivek Gurkha April 2, 2016 at 11:01 am · Reply

    Hi,
    I am using open Cart 2.0.2.0 and want to know How to increase the length of Text of “Geo Zone Name” Its giving me the max characters length 32 and i want to increase that. Please suggest.

  4. apostolos January 21, 2016 at 7:35 pm · Reply

    Hi , Thank’s for the tutorial. I want to ask you if I can desapear the “Flat rate” from displaying.
    If I disable or unsinstall from admin the OC can’t calculate give me error….
    Any idea?

  5. anuj April 12, 2015 at 11:15 am · Reply

    I Want add Shipping Charge In Price and Show Them On Product Page In Price. How I Do This..?
    Example :- Product Price Is 100$
    Shipping Charge is 5$
    Now I Want To Show Product Price 105$ On Product Page As Price.

    Thanks In Advance.

  6. STC February 1, 2015 at 5:02 pm · Reply

    Hi,

    Sorry, I’m new to FTP and such, but how do I change the name of the shipping method in weight.php file? Which part should I edit? Thanks in advance!

  7. Raluca Terente December 31, 2014 at 11:47 am · Reply

    Hello,

    This is a wonderful and easy to follow tutorial. However, I have a constant problem. I followed all the steps but still this shipment method does not show up during checkout. I’ve enabled the extension as a whole in the “General” tab, and each geo zone in its own tab. Could you give me some advice?

    Thank you in advance!

  8. Amelia July 3, 2014 at 11:32 pm · Reply

    Thank you so much for this!! Worked perfectly.

    Except this bit to remove the displayed cart weight –

    IN:
    /catalog/model/shipping/weight.php

    REPLACE:
    $result['name'] . ‘ (‘ . $this->language->get(‘text_weight’) . ‘ ‘ . $this->weight->format($weight, $this->config->get(‘config_weight_class_id’)) . ‘)’,

    WITH:
    $result['name']

    SHOULD REPLACE WITH:
    $result['name'],

  9. Kati June 27, 2014 at 10:51 am · Reply

    Thanks a lot!!! This helped a LOT!!!! Thanks for sharing!

  10. Johnathan Shaw January 31, 2014 at 12:14 am · Reply

    The tutorial should show you how to do that. You would create the appropriate geo zones (12 for standard, 12 for express) and then enter the rates appropriately. You’d essentially have 12 duplicates of geo zones, so that two options appear during checkout for each geo zone.

  11. Alex January 30, 2014 at 10:24 pm · Reply

    i meant to say weight based shipping. how do i create two diff weight based shipping, each having different zones

  12. John January 22, 2014 at 8:40 pm · Reply

    To work properly you need to assign a weight to every product. If it is not set you’ll get an error when checking out.

    I have just discovered this. Thanks for the tutorial.

  13. Johnathan Shaw December 17, 2013 at 7:03 pm · Reply

    If you only want Express showing, then setting its “Status” setting to “Disabled” in the Weight Based Shipping admin panel.

  14. Amit Vaid December 17, 2013 at 6:58 pm · Reply

    if i add deliervy address Geo Zone: Express then i want to show only Geo Zone: Express shippping cost bez i pay for this zone shiping then why show all how it possible

  15. RebeccaG November 13, 2013 at 10:25 pm · Reply

    This was amazingly helpful – especially when you’re dealing with multiple regions and rural delivery options. Thank you SO much.

  16. jan September 5, 2013 at 6:23 am · Reply

    Thanks ! Now it works – I was deleting that last comma right after square bracket – that was the problem .

    • Renwick March 8, 2014 at 7:55 am ·

      what this warning mean?Warning: rreqiue_once(home/test/public_html/system/startup.php) [function.require-once]: failed to open stream: No such file or directory in /home/test/public_html/admin/index.php on line 19Fatal error: rreqiue_once() [function.require]: Failed opening rreqiued home/test/public_html/system/startup.php’ (include_path=’.:/usr/lib/php’) in /home/test/public_html/admin/index.php on line 19

  17. Johnathan Shaw September 4, 2013 at 9:17 pm · Reply

    My last comment should read:

    …the browser is rendering > as &gt ; which…

  18. Johnathan Shaw September 4, 2013 at 9:14 pm · Reply

    Hi Jan — that error means you didn’t do the edit correctly. Make sure you follow it exactly — I recommend using the “Find” function of your text editor to make sure you’ve selected precisely the correct text. Right now, it looks like the browser is rendering the > as > which it should be doing, so you may need to do that to make sure you have the right line. Once finished, the line should read:

    ‘title’ => $result['name'],

  19. jan September 4, 2013 at 7:34 pm · Reply

    Hi
    Everything works like a charm but when I want to remove cart weight I get this error

    Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ‘)’ in /home/content/31/11535131/html/catalog/model/shipping/weight.php on line 46

  20. Jill August 29, 2013 at 6:44 am · Reply

    Many thanks, saved me a lot of time.

  21. Andrew July 11, 2013 at 10:45 pm · Reply

    Great tutorial! Really a great hack that you’ve come up with here.

  22. Philippe June 26, 2013 at 6:35 pm · Reply

    Many, many thanks…too simple that I was looking for a module…

  23. Şahin June 23, 2013 at 8:36 pm · Reply

    Thank you.

  24. Dave June 11, 2013 at 1:21 pm · Reply

    Thank you very much for this! It was way simpler than trying to make a module work somehow.

  25. Ronald May 31, 2013 at 7:04 am · Reply

    Thank you so much for this tutorial.

  26. Heru May 17, 2013 at 7:40 am · Reply

    Nice tuts. Thanks Jonathan

Leave a Comment

comm comm comm