# Shopware: Individual shipping costs0815

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:

Here you have several problems: The implementation of the rule "from 40 kg: € 49.90 basic price + € 0.59 per kg" is not easy to implement, values ​​such as 2,999 are not exact and there is no possibility of individual allocation of shipping costs per article . To make this possible, we first create a new free text field (eg "attr5") under Settings> Article> Article free text fields:

We will now fill this field with the value in euros for all articles that should have individual shipping costs. A point is used instead of a comma for decimal numbers:

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

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 with a weight of 2.5 kg cost € 14.97, three times the same item with a weight of 2.5 kg cost € 9.50. If you want to perform the calculation based on the total weight (with the result € 9.50 in both cases), you only change the calculation function minimally:

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