Im using magento v2.2.2 Im trying to fix some shipping rates that shipping company gave me.

I have 4 options

Destination        | shipping time | price up to 10 kg | price for extra 1kg
In city            | 1day          | 3.80€             | 0.50 €
Land Destinations  | 1-2days       | 6.00€             | 0.70 €
island destinations| 1-3days       | 7.00€             | 0.80 €
inaccessible areas | 1-5days       | 8.00€             | 1.50 € 

Also for inaccessible areas i have a large csv with their zip codes which i can upload in table rates.

In Table Rates Weight vs Destination csv we cant add dynamic value.The values must be fixed.

So im thinking to edit the magento module for shipping. Is this a good idea? If i can do that whats the proper file to edit.

Also is there a way to categorize all my state/prov into those 4 destination categories so i can manage better the shipping cost given the zip or state by the customer?

Thanx for any ideas.

2 Answers 2


The best approach would be creating a new shipping extension.

I have built a simple shipping skeleton you can take a look: https://github.com/thiagolima-bm/magento2-simpleShipping

The cost calculation could be made here: https://github.com/thiagolima-bm/magento2-simpleShipping/blob/master/src/Model/Carrier/Method.php#L69

There you can apply your own rules.

  • Is there a way to make a module that extend table rate shipping method? So i can do all the calculations without to enable a new shipping method. But thnx a lot for your answer i will try to work around with your extension Commented Feb 18, 2018 at 16:56
  • 1
    Yes, you can. You can use a plugin (devdocs.magento.com/guides/v2.0/extension-dev-guide/…). In any case you are going to need to create a custom extension. Commented Feb 18, 2018 at 17:03

The dynamic values are only problematic as long as the product quantity can really be infinite.

I would suggest that you think about the biggest order you ever had (or ever will have), and then just create a static CSV file using Excel or a small PHP script that lists all countries, zip codes, weights and shipping prices up to that maximum weight from the biggest possible order.

If you still need a shipping extension, my way to go would be Webshopapps. I am not associated with them, but their extensions are great.

  • Hi, since the eshop is under dev i cant estimate the biggest possible weight order. Each product weight from 5kg to 20kg as i seen. If we imagine that cart's weight is 100kg. Then in csv for one state/prov i need one cell for (up to 10kg) and 90 cells (up to 100kg) to calculate the extra kgs. At the end we have something like 60 state/prov with a realy large csv thats its messy. This method you describe will be good if somehow i can arange all the 60 state/prov into those 4 categories i describe (In city, Land Destinations,island destinations,inaccessible areas ) Commented Feb 18, 2018 at 18:12
  • ~6k rows in the CSV file should not be a problem imho. Anyway, with Webshopapps Matrixrate (I think this is the name), dynamic rules are possible Commented Feb 18, 2018 at 18:33
  • I'll check it. Thnx a lot for your time :) Commented Feb 18, 2018 at 21:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.