Value-added tax (VAT)

Many countries have what is referred to as a value-added tax (VAT). When a country uses VAT, tax is included in the price of each item. This means that no additional tax needs to be applied during checkout. However, most tax jurisdictions still require stores to show the amount of VAT that the customer paid.

In the admin, the Settings -> Taxes -> Tax Rates page allows administrators to create any tax rate. They can create VAT-style taxes by using the "Included in price" checkbox.

Solidus's solidus_frontend gem lists all of the VAT and other price adjustments below the item total on the checkout summary page.

Calculating VAT

When you set up products in Solidus, you can set the price to the exactly what you want the customer to pay. Then, you can use your VAT-style tax rates to allocate a percentage of the gross price to taxes.

    
      consumer_price / (1 + tax_rate) = expected_revenue
consumer_price - expected_revenue = vat

    
  

Solidus's Spree::Calculator::DefaultTax handles sales tax and VAT. If a tax rate is VAT and should be included in the price, it calculates all of the line items that share that tax rate on the order:

    
      if rate.included_in_price
  round_to_two_places(line_items_total - ( line_items_total / (1 + rate.amount) ) )
...
end

    
  

VAT amounts are stored in Spree::Adjustments

Note that while VAT does not adjust an order's total, Solidus still creates Spree::Adjustment objects to store tax amount. These objects have an included value of true so that the tax is not added to the price.

Example order with multiple VAT rates

In the following example, we will still refer to VAT as "adjustments", since that is how Solidus stores the tax amounts.

Our United Kingdom-based company is required to follow these tax regulations:

  • Items of clothing should be taxed at a 5% rate.
  • Consumer electronics should be taxed at a 10% rate.
  • We are required to display the VAT paid to the customer.

If a customer orders a single clothing item:

  • A customer within the UK adds one £17.99 t-shirt to their order.
  • The tax calculator calculates the VAT: 17.99 - (17.99 / (1 + 0.05)) = 0.86.
    
        £17.99 – 1 x T-shirt
  £0.86 – Clothing tax (5%)

  £17.99 – TOTAL

    
  

If a customer adds a second clothing item to the order:

  • The customer adds a £19.99 t-shirt to the existing order.
  • The total cost for the two items is £37.98.
  • Because the order only includes clothing items, the included tax is calculated as a single adjustment (5%).
  • The tax calculator calculates the VAT: 37.98 - (37.98 / (1 + 0.05)) = 1.81.
    
        £17.99 – 1 x T-shirt
  £19.99 – 1 x T-shirt
  £1.81 – Clothing tax (5%)

  £37.98 – TOTAL

    
  

If a customer adds a consumer electronics product to the order:

  • The customer adds a £16.99 power adapter to the existing order.
  • The total cost for the three items is £54.97.
  • Because the order includes both clothing items and consumer electronics, the tax must be calculated as two adjustments at two different tax rates.
  • The tax calculator calculates the VAT for the clothing items: 37.98 - (37.98 / (1 + 0.05)) = 1.81.
  • The tax calculator calculates the VAT for the consumer electronics item: 16.99 - (16.99 / (1 + 0.10)) = 1.54.

We can now show the display the final included VAT in the price when the UK-based customer arrives at the checkout summary page:

    
        £17.99 – 1 x T-shirt
  £19.99 – 1 x T-shirt
  £16.99 – 1 x Power adapter
   £1.81 – Clothing tax (5%)
   £1.54 – Consumer electronics tax (10%)

  £54.97 – TOTAL

    
  

Feedback

Solidus is an open source platform supported by the community. We encourage everyone using Solius to contribute back to the documentation and the code.

If you’re interested in contributing to the docs, get started with the contributing guidelines. If you see something that needs fixing and can’t do it yourself, please send us an email.