Simple Commerce includes two tax engines out of the box:
Simple Commerce then calculates the tax amount for each line item on an order.
To enable the Basic Tax Engine, your config should look like this:
// config/simple-commerce.php'tax_engine' => \DuncanMcClean\SimpleCommerce\Tax\BasicTaxEngine::class,'tax_engine_config' => ['rate' => 20,'included_in_prices' => false,],
// config/simple-commerce.php'tax_engine' => \DuncanMcClean\SimpleCommerce\Tax\BasicTaxEngine::class,'tax_engine_config' => ['rate' => 20,'included_in_prices' => false,],
As explained above, the Basic Tax Engine simply lets you define a flat tax rate which will be applied to all products & customers. The config allows you to define the tax rate (20% in the example) and whether or not tax has already been included in the product prices.
If you have a product which is exempt from tax, you may add a Toggle field to your Product blueprint, called exempt_from_tax
. Then, you may turn the toggle on for the product.
If you wish to enable tax for shipping costs, simply flick the toggle in your Simple Commerce config:
// config/simple-commerce.php'tax_engine_config' => [// ...'shipping_taxes' => true,],
// config/simple-commerce.php'tax_engine_config' => [// ...'shipping_taxes' => true,],
Now, the tax rate you have set for all products will also be applied to shipping costs.
When included_in_prices
is true
, you should ensure that your shipping cost includes any taxes.
The Standard Tax Engine is enabled by default in new Simple Commerce sites. You may enable it if you're on an older site like so:
// config/simple-commerce.php'tax_engine' => \DuncanMcClean\SimpleCommerce\Tax\Standard\TaxEngine::class,'tax_engine_config' => ['address' => 'billing','behaviour' => ['no_address_provided' => 'default_address','no_rate_available' => 'prevent_checkout',],'default_address' => ['address_line_1' => '','address_line_2' => '','city' => '','region' => '','country' => '','zip_code' => '',],],
// config/simple-commerce.php'tax_engine' => \DuncanMcClean\SimpleCommerce\Tax\Standard\TaxEngine::class,'tax_engine_config' => ['address' => 'billing','behaviour' => ['no_address_provided' => 'default_address','no_rate_available' => 'prevent_checkout',],'default_address' => ['address_line_1' => '','address_line_2' => '','city' => '','region' => '','country' => '','zip_code' => '',],],
There's three main concepts you'll want to be familuar with before you begin:
After enabling the tax engine, you will also want to go ahead and setup your Rates, Categories and Zones. Each of these have sections in the Control Panel.
If you'd like your client (or other non-super user) to be able to access these pages, you may give them access via Permissions.
Simple Commerce will automatically create a 'Default - Shipping' tax category when you enable the Standard Tax Engine.
This tax category will be used when Simple Commerce is figuring out what tax (if any) should be applied to shipping costs.
Similar to products, you may associate tax rates with the shipping category. Then tax will be applied to shipping in the user's cart.
If the order doesn't have an address when tax is being calculated, Simple Commerce will be unable to apply one of your Tax Rates.
In this case, you can either use a default address (default_address
) (eg. a physical store) for tax to be calculated from OR prevent the customer from checking out (prevent_checkout
).
If you use a default address, make sure you actually provide one or you may end up in an endless loop.
It's possible customers may run into issues where you don't have a Tax Rate setup for their address. For example: if you have a customer who's address is in the North Pole but you only have rates setup in the UK, then no tax rates will be found.
There's two solutions to this problem:
default_rate
) which will already exist after enabling the Standard Tax Engine.prevent_checkout
)