Calculation of the shopping cart

The heart of a store is the shopping cart. A comprehensible and correct calculation of the sums, items and VAT is essential to not disturb the confidence of customers in the store. For this reason, this article should clarify the calculation basis of the shopping cart and give you options to check the calculation yourself. In addition to numerous basic functions of Shopware such as extended prices, shipping costs, coupons and discounts, there are of course also countless extensions that hook into the calculation of the shopping cart. Thus, it is important that you also get an idea of which extensions may influence the calculation and what effects this may have.
 

Basics

In most countries, there are two valid methods for calculating VAT. The horizontal (line-by-line) and the vertical (column-by-column) method. In the horizontal method, the VAT is calculated per shopping cart item. The VAT percentages of each shopping cart item are displayed during the order completion process. The VAT total is then calculated from the VAT portions of the individual items.
In contrast, in the vertical procedure, the VAT total is calculated on the basis of the total order amount. The VAT portions of the individual items are not displayed in the order closing.

Shopware also shows two decimal places at all points on the storefront. So that your customers can always understand the calculation, it is also always calculated with the value rounded to 2 digits.

Calculation examples

Horizontal Calculation


Definition:
VAT is calculated individually for each line item – that is, item price × quantity, then the tax is calculated and rounded per item. At the end, all tax amounts are summed.

Typical Behavior:

  • Tax is calculated separately for each line item

  • Rounding occurs at the item level

  • Especially relevant when multiple quantities of the same item or many individual items are involved

Example:

ItemNet PriceVAT (19%)Gross Price
Product A€1.99€0.38€2.37
Product B€2.99€0.57€3.56
Product C€3.99€0.76€4.75
Total€8.97€1.71€10.68

In this example, tax is calculated individually for each item (e.g., Product A: €1.99 × 19% = €0.38 VAT). At the end, all separately calculated taxes are added together.

Vertical Calculation


Definition:
VAT is calculated only after summing all net amounts. Then the tax is applied to the total net amount and rounded once.

Typical Behavior:

  • Tax calculation is done at the total level

  • Rounding occurs only once at the end

  • Ideal for even amounts or invoices based on total values

Example:

ItemNet PriceVAT (19%)Gross Price
Product A€1.99 €2.37
Product B€2.99 €3.56
Product C€3.99 €4.75
Total€8.97€1.70€10.68

In this example, no tax is calculated per item. Instead, VAT is calculated based on the total net amount: €8.97 × 19% = €1.70 VAT.

Compared to horizontal tax calculation, there's a rounding difference of €0.01.

Explanation

In the vertical calculation, the net total per tax rate is determined for the entire invoice and the VAT total is calculated from this. In the horizontal calculation, the VAT is calculated for each individual item line, taking into account the respective tax rate. Both methods of calculation are legally allowed, but can lead to rounding differences in the case of decimal places.

Sales channel - settings

You store the tax calculation in the settings of the sales channel in the Payment and shipping area.

Price rounding and decimals

Under Settings > Localisation > Currencies you can configure the price rounding for different currencies. There you can configure the rounding for individual items of the shopping cart and the rounding for the total amount of the shopping cart.
You can find more detailed information about this in the article Currencies.

Countries - Tax-free

Under Settings > Localisation > Countries you can set for the respective country whether the tax calculation in the shopping cart is free.

Debugging

Shopware does not have a central place to calculate the shopping cart. The calculations in the front- and backend are basically separated from each other. Therefore, you should always follow the complete path in your store if you suspect an error here. The best thing to do when a customer contacts you is as follows:

  • Reconstruct shopping cart in storefront
  • Take a screenshot of the order completion page (/checkout/finish)
  • Compare totals in the order overview with the screenshot
  • Compare totals in PDF invoice with screenshot
  • Check calculated shopping cart with Excel spreadsheet

If a problem is confirmed here, you should first check whether one of the extensions used interferes with the calculation of the shopping cart. To do this, you can set up a test environment that does not contain any extensions.

Was this article helpful?