Shipping Method: Weight-Specific for each country

Hi there,

first of all: i love the idea of Commerce! That’ll be THE commerce solution for MODx, so keep it going! :slight_smile:
I am migrating a Magento Shop to Commerce. That involves a lot of CSV exporting and importing (doing the resource-based solution, as we only have unique products and the import is quite a no-brainer). I have come to the point where I need to setup the shipping method.

We are selling music sheets. It’s similar to selling books: each book (or music sheet magazine) has it’s own weight. Based on the weight we do our pricing for the shipping - exactly like you can set it up in the Weight-Specific Shipment Method.

But we do ship in different countries - and the shipping costs vary from country to country and in addition to that there are different “gram-steps”.

Example:
Shipping in Germany
0 - 350g : 1.50 €
351g - 500g : 3.20 €

Shipping to Belgium
0 - 300g : 1.80 €
301g - 480g : 3.60 €

and so on…

So what I would need is basically the best of both worlds: The Weight-Specific and Country-Specific Shipping Methods combined. There is no chance in setting up fixed prices for each country, as the shipping costs depend on how much books (music sheet magazines) you order - and on the countries, too.

To be honest I think that this is a quite common use case? Maybe I am wrong… but it was a no-brainer in Magento, maybe one of the few things worth copying from them? :wink:

In Magento this is called “Tablerates”. This is what my tablerates.csv looks like (it goes on for quite a bit).
The columns are: Country / Region / Post Code / Grams (this number + everything above until the next step) / Price

Cheers from Germany,
Andi

Hi Andi!

Thanks for the kind words :smiley:

There is indeed a good use case for a better combination of the weight-specific and country-specific shipping method. I’ve had the same thing setting up the modmore merch store, where shipping to some countries is cheaper than others, and it also depends (very much so) on the total order weight.

What I ended up doing there was using the weight-specific shipping method, with the built-in country restriction, shown further down under the Availability section.

If your prices differ for each individual country (I only had to setup 4 different zones), that’s going to be a bit of a pain to set up manually for each one, but hopefully you only have to do it once :wink:

Tablerates looks interesting. I see it depends on a CSV (/spreadsheet) for the rates, which resolves the biggest challenge I’d see combining the weight and country shipping methods: making it easy enough to manage the different rates. Perhaps worth building a compatible custom shipping method…

Hi Mark,

thank you very much for your quick reply!

I guess I have to dive deeper into the weight-specific shipping method - will do that for sure!

I added a screenshot of my CSV to my initial post. I can send it over to you if you want to have a look at it. It’s nothing special, but very easy to maintain and keep track on all your shipping prices. Magento had an import and an export button for the tablerates CSV in the backend. So you could download your CSV, edit it, and upload it again. I found that to be very useful.

Hi Mark,
there is one more tricky thing regarding tablerates: the actual weight of the packaging.

The more books we send -> the bigger the box gets -> the more the box itself weights -> the more the shipping costs. So it not only depends on the sum of the weight of the books, but also on which box you send it in.

Quick breakdown: In Commerce we set the weight for each product. In the tablerates we set the “steps” which have to include the packaging-weight. Maybe there is a more elegant solution for this instead of calculating each step individually.

The box weight is an interesting one… even if you were to custom code the business logic, that would be super tricky to get exactly right for different types of products and shipments. Maybe 3 small books will fit in a normal box, but for encyclopedia’s you need a bigger box when the customer orders 2.

One potential way I can imagine fixing something like that, is adding the physical size (width/depth/height) to a product, defining what packaging you have, and then trying to calculate what box to use based on that. You’d still have exceptions (maybe 5 circular products could fit in a certain size box, while 5 square products with the same width/depth would need a bigger one) but you’d get pretty close that way.


As for the TableRates, I more or less have that integration done. Only the “weight” condition at the moment, but adding the “price” and “items” options wont be too hard now.

The source is on GitHub.

Note that it depends on a fix in the Commerce core (it wasn’t saving the weight to the shipments), which I’ve prepared to be included in 0.10.1. I’ll release that update later today or tomorrow, and will also make the TableRates module available from the modmore package provider after that.

0.10.1 is now available:

The TableRates package is also in the provider, as a pre-release. See https://support.modmore.com/faq/5-package+provider/#faq_161 for instructions on how to access the pre-releases. Let me know how it goes :slight_smile:

I still need to prepare documentation, a landing page, etc, but that’ll probably come in the new year.

1 Like

I totally agree with you: covering each and every scenario of multiple products packed in one shipment and kind of predict the right weight for it is nearly impossible. The idea of adding the physical size is interesting, but would be an overkill for my suits - at least at the moment.

And regarding the tablerates… what can I say. Asked for it, got it within what - an hour? That’s unbelievable, Mark. Thank you so much!! Will do the upgrade and report back. Can’t wait to try it out!! :heart_eyes:

Well, technically, it took like 4 hours :stuck_out_tongue:

Well, technically, you are awesome :wink: