Calculation of the shopping cart

Introduction

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

  • Row by row (horizontal) calculation
    Net
    QuantityVAT-SetNetGrossNet totalplus VATGross total
    571,49-5*1,497,45*0,077,45+0,52
        7,450,527,97

    Gross
    QuantityVAT-SetNetGrossNet totalplus VATGross total
    57-1,597,95/1,077,95-7,435*1,59
        7,430,527,95
  • Column by column (vertical) calculation
    Net
    QuantityVAT-SetNetGrossplus VATNet-totalplus VATGross total
    571,491,590,105*1,495*0,107,45+0,50
         7,450,507,95

    Gross
    QuantityVAT-SetNetGrosscont. VATNet-totalcont. VATGross total
    571,491,590,107,95-0,505*0,105*1,59
         7,450,507,95

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 > 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 > 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?