1

I would like the user to be able to switch between currencies (and tax), but I haven't figured out how to pull the currencies defined in Craft Commerce into a for loop. (I am pretty new to this platform)

I need this to be changeable on the front end via both a drop down menu in the header and automatic Geo locating.

Any suggestions greatly appreciated :)

1

The Cart's currency {{cart.currency}} is always the default base currency. You can't change or switch this currency.

This means all prices/discounts/taxes are all stored and entered in that currency.

In the example templates, the price of items is shown in that currency using the currency filter and passing in the cart.currency like so:

Sale Price Subtotal: {{ item.subtotal|commerceCurrency(cart.currency) }}

When the user goes to pay for the order, we allow them to pay in a different currency called the paymentCurrency this is accessible with {{cart.paymentCurrency}}. You can also change the cart's current payment current with the controller action commerce/cart/updateCart and passing a valid currency ISO. The ISO you pass must be a valid one set up in your settings, along with a conversion ratio.

We don't recommend converting the price of all items with the payment currency using the currency filter, as the total will not match the order amount. We recommend only converting the actual payment due or order total.

In addition to changing the payment currency with controller action here are the other ways you can change the payment currency: https://craftcommerce.com/docs/payment-currencies#switching-currencies

By default the payment currency is the default currency of the system.

As for taxes, these are always based on the shipping address. So the only way to switch the tax rate would be by the customer changing their shipping address on the cart. FYI there is an option to base the tax calcs on the billing address:

https://craftcommerce.com/docs/configuration#usebillingaddressfortax

Hope that helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.