<p><strong>Commerce 2</strong></p>

<pre><code>{% set allTaxRates = craft.commerce.taxRates.allTaxRates() %}

{% for taxRate in allTaxRates %}
    {{ taxRate.name }}&lt;br&gt;
{% endfor %}
</code></pre>

<p><code>taxRate</code> will be an instance of <code>craft\commerce\models\TaxRate</code></p>

<hr>

<p><strong>Commerce 1</strong></p>

<p>If you're looking to get all of the tax rates setup in Commerce from a template, something like this should work:</p>

<pre><code>{% set allTaxRates = craft.commerce.getTaxRates() %}

{% for taxRate in allTaxRates %}
    {{ taxRate.name }}&lt;br&gt;
{% endfor %}
</code></pre>

<p><code>taxRate</code> will be an instance of <code>Commerce_TaxRateModel</code>.</p>

CC BY-SA 4.0
2018-06-15T15:10:14.780Z
Thanks Brad. Is there a link to the docs for this? I knew there must be a way to do it but couldn't find anything.
foamcow
CC BY-SA 4.0
2018-06-15T22:21:15.897Z
Nope... just looked at the code.  We've got a big push to improve the Commerce 2 docs we're working on, though.
Brad Bell
CC BY-SA 4.0
2018-06-15T00:09:31.780Z
2018-11-28T04:33:58.870Z
2018-11-28T04:33:58.870Z
Brad Bell
<p>Is there a way to retrieve and loop through all the available tax rates that have been set up in Commerce 1?</p>

<p>I had thought I could loop through the adjusters like so;</p>

<pre><code>{% for adjustment in cart.adjustments %}
    {{ adjustment.name }}
{% endfor %}
</code></pre>

<p>In fact, I'm doing this on one site with no problems but having just tried the same thing on another project I am running into errors. I'm guessing because no adjustments exist unless there is actually a cart object.</p>

<p>I am trying to retrieve its value in order to display the price including tax on my product page template. For this particular case I only have 1 tax rate, so there is no problem with regionality. I figured that I could loop through the adjuster, check the name and retrieve the value.</p>

<p>If there's another way to do this I'm all ears!</p>

<plugin-craftcommerce><adjusters><tax>
How to get all available tax rates in a Commerce site?
# How to get all available tax rates in a Commerce site?

(Asked by: username_0 on 2018-06-13)

Is there a way to retrieve and loop through all the available tax rates that have been set up in Commerce 1?
I had thought I could loop through the adjusters like so;
{% for adjustment in cart.adjustments %}
    {{ adjustment.name }}
{% endfor %}

In fact, I'm doing this on one site with no problems but having just tried the same thing on another project I am running into errors. I'm guessing because no adjustments exist unless there is actually a cart object.
I am trying to retrieve its value in order to display the price including tax on my product page template. For this particular case I only have 1 tax rate, so there is no problem with regionality. I figured that I could loop through the adjuster, check the name and retrieve the value.
If there's another way to do this I'm all ears!

**Tags:** plugin-craftcommerce, adjusters, tax


---

## 1 answers

### Answer by username_1 on 2018-06-15. Score: 2 | Accepted answer

Commerce 2
{% set allTaxRates = craft.commerce.taxRates.allTaxRates() %}

{% for taxRate in allTaxRates %}
    {{ taxRate.name }}
{% endfor %}

taxRate will be an instance of craft\commerce\models\TaxRate

Commerce 1
If you're looking to get all of the tax rates setup in Commerce from a template, something like this should work:
{% set allTaxRates = craft.commerce.getTaxRates() %}

{% for taxRate in allTaxRates %}
    {{ taxRate.name }}
{% endfor %}

taxRate will be an instance of Commerce_TaxRateModel.

> **Comments:**
> **username_0**: Thanks Brad. Is there a link to the docs for this? I knew there must be a way to do it but couldn't find anything.  
> **username_1**: Nope... just looked at the code.  We've got a big push to improve the Commerce 2 docs we're working on, though.  

---

