Shopware: Individual shipping costs

Shopware has a powerful shipping cost module that you can specifically intervene in the calculation. In our case, we want to implement the following scenario: The shipping costs per article are initially determined according to the weight of the article (the weight limits are specified). Only for special exceptions should it be possible to set fixed shipping costs for each item.


The table of shipping costs is as follows:

Weight of Weight up Price
0 kg < 3 kg 4,99 €
3 kg < 5 kg 6,90 €
5 kg < 10 kg 9,50 €
10 kg < 15 kg 10,90 €
15 kg <20 kg 12,90 €
20 kg < 31 kg 17,90 €
31 kg < 40 kg 49,90 €
from 40 kg 49.90 € basic price + 0.59 € per kg

At first you might get the idea of ​​selecting the value "Weight" in the field "Shipping costs calculation according to:" and entering the corresponding limits below:

Shopware: Individual shipping costs

Several problems arise here: The rule "from 40 kg: €49.90 base price + €0.59 per kg" is not easily implemented, values like 2.999 are inaccurate, and the option to assign individual shipping costs per item is missing. To address this, we first create a new free text field (e.g., "attr5") under Settings > Items > Item Free Text Fields.:

Shopware: Individual shipping costs

We will now fill this field with the value in euros for all items that should have individual shipping costs. For decimal numbers, use a period instead of a comma.:

Shopware: Individual shipping costs

Finally, we create a new shipping method with the important settings "Shipping cost calculation according to: Own calculation" and "Factor (%): 100:

Shopware: Individual shipping costs

Finally, under "Advanced settings" we store our new calculation function under "Own calculation".:

a359cdf87765551f0706

This function takes the weight of each item and calculates the price. Three different items weighing 2.5 kg each would therefore cost €14.97, while three identical items weighing 2.5 kg would cost €9.50 each. If you want to calculate the price based on the total weight (resulting in €9.50 in both cases), you only need to make a minor adjustment to the calculation function.:

a359cdf87765551f0706

If merchants are also to be included, you must pay attention to the prices in the SQL query to see whether they are net or gross values (depending on the values set in Basic settings > Shop settings > Customer groups > Enter gross prices).

If you want to include the article characteristic "Mark article as free of shipping costs" as well (per article), address the column b.shippingfree and set the following option in the "Settings > Shipping costs > Advanced settings > Free shipping articles:

With the help of SQL, you can build in queries of any complexity. It is recommended to prepare the final query with the help of SQL variables, so that the whole thing remains nicely maintainable. The following is an example of a more complex query, which differentiates between shop customers and retailers, takes into account articles free of shipping costs, charges shipping costs only for a maximum shopping cart and taps different price scales (depending on brand):

a359cdf87765551f0706

Back