Posted on

# Shipping rates per product size on WooCommerce

Some time 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 Greater Than comparison, and set 120 cm, there is: only a dimension that exceeds (greater 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: If we have a big product and an small one, only the most bigger (expensive) shipping cost 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:

Post update: In this case, we will need the Pro version. Then can use the new logic feature: instead of the default AND, use OR in the same rule: if product exceed Max dimension OR Mid dimension OR Min dimension, set the shipping cost per product.

All products will fulfill rule #1, and big ones will fulfill also the rule #2, ensuring that only one cost of 15\$ will be applied for every big product, and small ones will fulfill only the #1 and costs 5\$ :

With this configuration, all products will cost 5\$, and the products that exceeds one or more dimensions, will add the +10\$ cost to the shipping rate. A small product, will meets the #1 only.

## Weight and size shipping costs

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 offer his 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.

To achieve this, delete the “always” rule, and add another one to the end: for weigh carts (+30kg), set the price weight-based.

…and we need to exclude the weight of the large products (that paid 15\$ everyone) on the weight shipping costs calculation. Add on the rule #1 the special action: “Unset match prods for next rules”. It will ensure that only one cost will be applied for every product, the matching products (large) will not be analised in the next rules:

## Set shipping cart weight limit: grouping products

And fillally, we must set the products agrupation. We want that I.E. two 20kg fulfill the #2 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 second 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, remove the special action. Then the big sized products will meet rule #1 + rule #2.