How to set up tax rules for sales within Canada in Magento

Objective: Set up the taxation system for Magento for sales within different provinces of Canada.

Entering the Tax Rates for Retail Sales in Canada

The tax rates used in this example are listed below. DISCLAIMER: the rates and tax rules may not be correct or up to date and are listed here to demonstrate how different rates can be implemented in Magento. Do not use these rates without verifying with the proper authorities that they are correct.

Location Rate Note
GST (Canada-wide) 5% Applied to products and shipping all over Canada.
HST (New Brunswick) 13% Includes GST
HST (Nova Scotia) 13% Includes GST
HST (Newfoundland) 13% Includes GST
PST (Ontario) 8% Added to GST
PST (British Columbia) 7% Added to GST
PST (Manitoba) 7% Added to GST
PST (Saskatchewan) 5% Added to GST
PST (Prince Edward Island) 10% Compounded with GST
TVQ (Quebec) 7.5% Compounded with GST

* Tax rates for the territories are not included here, and to my knowledge Alberta does not have any retail sales tax.

The first step is to set up the tax rates within Magento.

Go to Sales > Tax > Manage Tax Zones & Rates. Click Add New Tax Rate and fill out the relevant information. Enter the name of the tax in the Tax Identifier. This name will appear on the customer’s invoice. Leave the Zip/Postal Code field with a “*”. For the rate field you can enter integers to represent the percentage of the tax. For example, entering 7 will set the rate to 7%.

After you entered all the rates for each province the Manage Tax Zones & Rates main screen should look like this.


Tax Rates for Canada

Tax Rates for Canada

Setting up the Tax Rules

Now that we have defined the tax rates for each province we need to give Magento some more information about how to use the rates:
•    Taxes (as defined below) are applied to all products and shipping charges for all customers.
•    GST is applied to all products sold to any province except NB, NS, and NF where HST is applied
•    For Ontario, BC, Manitoba and Saskatchewan, apply GST to the amount before taxes and apply PST to the amount before taxes and add them up for the grand total.
•    For PEI and Quebec apply the GST to the amount before taxes and then apply PST/TVQ to the (amount before taxes + GST)

To set up the tax rules open up Sales > Tax > Manage Tax Rules and click Add New Tax Rule. In the Tax Rate field you will see all the rates that were added in the previous step.

Setting up GST and HST

Let’s add the GST for all provinces and the HST for the relevant provinces for taxable goods and shipping (as far as I know shipping is provided as a service and can be marked up and is therefore taxable in Canada – don’t take my word for it).

Name: Retail Customer-Taxable Goods-Canada  (can be anything you like)
Customer Tax class: Retail Customer
Product Tax class: Select both Taxable Goods and Shipping by pressing down Ctrl and clicking on the two items.
Tax Rate: Select GST and the HST tax rates (for NB, NS, NF)
Priority: Set this to 1. This field will be explained later.
Sort Order: Set to 1.

Save the tax rule and let’s see if this worked. Go to your store and add an item in the cart. When the shopping cart page is displayed you should see an Estimate Shipping and Tax box. Select Canada, Newfoundland and click Get a Quote.


Testing Magento Tax Setup

Testing Magento Tax Setup

You should now see a little + to the left of ‘Tax’ in the grand total box. Click that to open up the tax details.

Note: If you’re not seeing the tax details, it may be because the store is configured to hide the tax details. To fix that go to System > Configuration > Tax : Display  and set Display Full Tax Summary to “Yes”.

If you select a province like Ontario or British Columbia you should see:

Subtotal with taxes

Subtotal with taxes

This is incorrect because for these provinces we need to apply the PST to the subtotal and add it with the GST to determine the ‘Grand Total’.

Adding non-compounded provincial sales taxes to the GST

As listed in the table at the beginning of the post, the PST for Ontario, British Columbia, Manitoba and Saskatchewan must be added to the GST, but unlike compounded taxes like the TVQ and the PST in Prince Edward Island, the PST must be applied to the original subtotal and then added to the GST.

To do that we need to add individual tax rules for the tax for each province as follows.

Magento Partial Tax Rules

Magento Partial Tax Rules

By setting the Priority field to 1 we are telling Magento to add the tax with other taxes with the same priority (like the GST tax defined with the rule Retail Customer-Taxable Goods-Canada).

Try out these new settings.

Adding compounded provincial sales taxes to GST

In PEI and Quebec the provincial tax is applied to the amount = subtotal + GST applied to the subtotal. To define this compounded tax rule we need to tinker with the Priority field and set this field to 2 (since our GST tax rule has priority 1).

The final tax rule table will look like this:

Magento Full Tax Rules

Magento Full Tax Rules

Troubleshooting

If the taxes changing as you select different provinces in the estimator you may want to check the ‘Tax Based On’ field in System > Configuration > Tax : Calculation . Make sure it is not set to ‘Shipping Origin’.

Reference: This post was created using in part information from a very helpful post on the Magento forum.

Also read...

Comments

  1. Very well explained.. BUT for some reason, when an Ontario order (for example) is placed.. the tax is totaled on the GST line and the PST line appears but with no value in the field. Do you know how to fix this? Law requies Ontario to separate out the GST adn PST on separate lines with separate values

  2. Hi Andrew,

    Sorry about the late reply.

    Good point! The problem starts in /app/design/frontend/default/default/template/checkout/total/tax.phtml

    That’s where the tax details are being compiled (unless your current theme overwrites this file).

    I will look into this and post an update.

    Thanks for your comment!

  3. I also found this little tutorial very helpful. But of course, I too would like to get the GST and PSTs seperated.

    Thanks alot! I will look into the template too.

  4. Here’s my fix in template/checkout/total/tax.phtml

    right after
    1){
    $rate['amount'] = ($rate['percent']/100) * $subtotal;
    }else{
    $rate['amount'] = $amount;
    }
    ?>

    And then, when it’s displayed later on:

    <td rowspan="” class=”a-right” style=”getTotal()->getStyle() ?>”>
    helper(‘checkout’)->formatPrice($rate['amount']); ?>

    You can of course remove the commented out if and the rowspan altogether since we’re not using it anymore.

    I’ve tried it on some different totals and it seems to work fine.

  5. Sorry about the php tags messing stuf up here so, right after: foreach ($rates as $rate):
    if(count($rates) > 1){
    $rate['amount'] = ($rate['percent']/100) * $subtotal;
    }else{
    $rate['amount'] = $amount;
    }
    $rate['amount'] = $amount;
    }

    And then, remove the if ($isFirst): end it’s endif.
    The rowspan is now useless.
    And change the line that displays the amount to
    $this->helper(‘checkout’)->formatPrice($rate['amount'])

  6. Thanks Eric! In principle this should work, but there are three things that need to be addressed:

    1. How do you get the subtotal? This something that really confuses me about Magento. I’m quite familiar with MVC, but I can’t for the life of me understand what controller this template belongs to.
    2. This solution works fine with non-compounded tax rates, but it would be nice for it to handle compounded rates as well.

    As a note: Calculating the tax amounts in the template violates MVC rules. Calculations need to be done in the model, or in the worst case in the controller. The model that performs the tax calculations for a given address is Mage_Sales_Model_Quote_Address_Total_Tax. It uses Mage_Tax_Model_Calculation. So ideally, the solution would happen in this model (I think).

    Having said all this, thanks for your comment. This is a great quick fix for Ontarians. If you know how to get the $subtotal, please post a comment and I will update the post with your solution.

    Thanks again,
    Monica

  7. You can get the subtotal with:

    $totals = Mage::getSingleton(‘checkout/cart’)->getQuote()->getTotals();
    $subtotal = $totals["subtotal"]->getValue();

  8. Pingback: How to configure Magento for sales tax in Canada | Blue Lotus Creative

  9. wow, thats random, someone posted a link to my blog post about this article. Well, anyways, hope this article helps. Its very detailed. Please comment if you find it useful.

  10. Thank you for your tutorial. Very helful. It works great for me with the compounded taxes but it only applies the GST for my HST provinces. My priorities looks to be setup ok… :-( Any idea why it’s doing that ?

  11. Hello again guys!

    I just came back here because I was looking for something else and just noticed that I forgot to tell you how to get the subtotal. No, it is not the way Scott said it, you just need to put
    $subtotal =($amount / $percent)*100;
    right before my $rate['amount'] = ($rate['percent']/100) * $subtotal; statement. This will work fine with every type of taxes.

  12. Mine is doing the same as Alex. Why?

    Alex | Jul 1st, 2010

    Thank you for your tutorial. Very helful. It works great for me with the compounded taxes but it only applies the GST for my HST provinces. My priorities looks to be setup ok… :-( Any idea why it’s doing that ?

  13. Hi,

    Is it possible to show Tax details in a PDf invoice. We have a hard time showing the 5% GST and 7.5% PST.

    This would help VERY VERY much.

    Michael

  14. Thank you for your grate instruction.

    I have a question:

    In BC there is a Levy / Environmental fee that should apply to some products. For example if you want to buy a ‘LCD Monitor’ there is an extra $11.00 environmental fee before tax. Or, $5.00 environmental fee for every ‘Tire’ for your car. How can I set up Magento to add these extra fees for only BC customer’s base on the special amounts of every required product?!!

    (the environmental fee is different for every product, and some products doesn’t have it at all)

    Thank you for your help in advance.
    Alex

  15. You you should change the post name Sleekd » How to set up tax rules for sales within Canada in Magento to something more specific for your content you create. I loved the the writing nevertheless.

  16. Is it possible the option to show the tax details isn’t there in the free version of magento ? Because I don’t seem to see the option “configuration” in “System” menu.

    As quoted from the article:
    Note: If you’re not seeing the tax details, it may be because the store is configured to hide the tax details. To fix that go to System > Configuration > Tax : Display and set Display Full Tax Summary to “Yes”.

  17. Pingback: Magento Canadian Taxes Setup | InnoVeight.ca

  18. Hi Monica,

    i want to set up a canadian store, but i want to make sure that the shop shows a grand total price and tax will be included in that price after checkout. I want to offer the same grand total price all over the country. Is that possible?

    thanks in advance,

    Jan

  19. Woah your blog is fantastic i’m keen on looking at your content. Continue to be up the great work! You already know, loads of people are searching round in this info, you could possibly help them greatly.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>