Calculation of the Cart

Version

5.5.0 or newer

Table of contents

Introduction

The heart of a shop is the shopping cart. A comprehensible and correct calculation of the sums, positions and taxes is essential in order not to disturb the confidence of the customers in the shop. For this reason, this article should once clarify the calculation basis of the shopping cart and give you opportunities to check the calculation yourself. In addition to numerous basic functions of shopware such as price groups, discounts and surcharges, shipping costs, vouchers and promotions, there are of course also countless plugins that take part in the calculation of the shopping cart. Therefore it is important that you also get an idea of which extensions may influence the calculation and what effects this may have.

 

Basics

In Germany there are two valid methods for calculating VAT. The vertical and the horizontal method. Shopware uses the vertical method, where the tax is calculated at item level, rounded and finally added together. In contrast, the horizontal method first calculates the sum of the VAT contained in all products and then rounds it. The use of the vertical method enables the tax contained in each item to be shown on the /checkout/confirm page. This is not possible with the horizontal procedure.

Shopware also shows two decimal places at all points of the frontend. So that your customers can always follow the calculation, the value rounded to 2 digits is always used.

 

Calculation Examples

Net Price

Vertical (used by shopware)

QuantityTax RateNetGrossplus VAT Net Totalplus VATGross Total
571,491,590,10 5*1,495*0,107,45+0,50
      7,450,507,95


Horizontal

QuantityTax RateNetGross Net Totalplus VATGross Total
571,49- 5*1,497,45*0,077,45+0,52
     7,450,527,97


Gross Price

Vertical (used by shopware)

QuantityTax RateNetGrossplus VAT Net Totalplus VATGross Total
571,491,590,10 7,95-0,505*0,105*1,59
      7,450,507,95


Horizontal

QuantityTax RateNetGross Net Totalplus VATGross Total
57-1,59 7,95/1,077,43-7,95

5*1,59

     7,430,527,95

 

Explanation

The calculation differences arise here on the basis of the calculation method used. In online shops, the vertical calculation is the more common method, since it is important for many shop operators to be able to show the VAT contained at item level. This would not be possible with the horizontal calculation, since the rounded item values can never result in the total value.

 

Debugging

Shopware does not have a central place for calculating the shopping basket. The calculations in the front- and backend are basically separated from each other. Therefore, you should always follow the complete path in your shop if you suspect an error here. Best you proceed as follows, if a customer contacts you:

 

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

 

If a problem is confirmed here, you should first check whether one of the plugins used interferes with the calculation of the shopping cart. For this you can use the security mode or set up a test shop that does not use any plugins.