A few days ago, an user asked us how to calculate shipping rates per product size on a WooCommerce shipping method. At the end of this post, we will solve the full case. Not obvious, because it mixes weight, size and some exclusion conditions.
We had think that this case will be useful to understand how Fish and Ships works with complex conditions. In this post, we will conver it step-by-step, from simple to complex case…
Calculate shipping rates if the product exceeds determinate size
This is the simplest case. Let’s say we will set a low flat shipping rate for small products (5$), and a bit more if the product size exceeds 120cm (47 inches) on his biggest dimension (15$):
We will set a first rule, wich will charge always 5$. And a second one, that only will charge 10$ (more, over the first 5$). Under the big box condition (you can use our free shipping plugin for this):
We set the Greather Than comparison, and set 120 cm, there is: only a dimension that exceeds (greather than) the MIN value, will fulfill the rule #2, and the shipping cost will be set.
The rule #1 will be match always, on any cart, and the rule #2 only will meets when the greatest dimension exceeds 120cm. In this case, the shipping rate is: 5$ + 10$ = 15$. Well, easy so far…
A realistic case: calculate shipping rates looking at the three box dimensions
In a realistic scenario, parcel company will set our box limits in this way: maximum 120x60x40cm (47x24x18 inches). Now, we should take care to no exceed anyone of this three dimensions, not only looking for the greatest one.
This is a more complex case, because one dimension that exceeds, should set the shipping rate as 15$. We can set one rule for every size, this is the first approach, but, what about if one product exceeds two or three dimensions? We won’t charge more than one rules at the same time on the shipping cost… fortunately, we have a setting to charge only the most expensive rule:
If the product exceeds, let’s say the 120cm and the 60cm, the rule #2 and #3 will match. But we won’t 15$+15$, then we will set only the expensive rule will be applied. However, this trick has a flaw: only the most bigger (expensive) shipping rate product in cart will set the shipping rate. What about if we want to set costs for every product?
Calculate shipping rates for every product, not once
In this case, we will need the Pro version. We will use an special action: “Unset match prods for next rules”. It will ensure that only one cost will be applied for every product: the matching products will not be analised in the next rules. Then, we drag the first rule to the bottom (we use the right icon to do it). Set again the calculation type as “charge all matching rules”. And last, set a special action on every rule that have dimersion condition:
With this configuration, the products that exceeds 120cm, will add the 15$ cost to the shipping rate, and it will not be analysed on the next rules. Let’s say a 130x90x50cm. It will meets the first rule, and it not be analised for the rest of the rules. Another product, with 80x80x80cm, will skip rule #1 because not meets, but trigger the rule #2, and will not be analised for the rest. A small one, will meets the #4.
Two shipping plugins at the same time
And finally, this is the case study, with full customer conditions: He needs shipping rates per product size in a real scenario:
- Matkahuolto (our national Bus delivery, on Finland), that will only accept shipments under 30kg and parcels 120x60x60cm. There is no limit on how many parcels are in shipment, as long as the combined weight is under 30kg. Shipping rules are handled with plugin by Matkahuolto
- DB Schenker (the alternate parcel service), get anything that goes over the limits mentioned above will be shipped with this service. Shipping rules are handled with your Fish and Ships plugin.
Our customer needs that Fish and Ships don’t allow any shipping method if the other plugin set his own. Let’s disable free shipping rate: any cart that no fulfill any rule (because haven’t any big / +30kg parcel), will cost 0. The shipping method will not be offered in this case. We must change the “always” on rule #4 for the weight equal or greater than 30kg.
Set shipping cart weight limit: grouping products
And fillally, we must set the products agrupation. We want that I.E. two 20kg filfill the fourth rule, there is: 20+20kg is greater than weight limit. If we leave the group setting as default, every product will be considered one by one, then every 20kg product will not meet the fourth rule. We must take all products as one before compare it with the limit weight:
…and that’s all! If you want to charge at the same time weight and big sized products, move (drag it with the right icon) the rule #4 to the top, then the big sized products will charge the shipping rate weight-based before it run the unset special action.