This section covers our Currency & Tax Code changer tools.
Our Tax Code Changer will allow you to output a list of all Tax Codes on your site that are linked to the current session's currency. You can then set a new Tax Code for that session.
The JS function must be sent a valid Tax Code ID. See the layout named default
for an example of how this is achieved via a <select />
dropdown.
You can add a Tax Code Changer to your site using the following include:
<div data-gb-custom-block data-tag="-" data-0='ecommerce/tax_code_changer' data-1=', layout: ' data-2='default'></div>
You can find layouts at layouts > modules > module_14 (eCommerce) > components > tax_code_changer > your_layout_name_here
The layout will require a wrapper
and item
file, which you can see in place in the layout named default
that comes installed with the eCommerce Module.
In the eCommerce Module, a formatted price is generated so partners can quickly output the correct price. However, you may sometimes need to convert a "raw" price integer to a currency format.
Instead, we can include price_formatter
, which will convert the price from cents to dollars (or your currency's equivalent)
Here my_price_variable
is the variable containing a price you'd like to format. This will then output the formatted price.
Our Currency Changer will allow you to output a list of all currencies on your site, and then set a new currency for that session.
The JS function must be sent a valid currency code in lowercase. See the layout named default
for an example of how this is achieved via a <select />
dropdown.
When changing currency, then default Tax Code for that currency is also automatically applied.
You can add a Currency Changer to your site using the following include:
<div data-gb-custom-block data-tag="-" data-0='ecommerce/currency_changer' data-1=', layout: ' data-2='default'></div>
You can find layouts at layouts > modules > module_14 (eCommerce) > components > currency_changer > your_layout_name_here
The layout will require a wrapper
and item
file, which you can see in place in the layout named default
that comes installed with the eCommerce Module.