1

I've got a site where each product will be sold in either Pounds or Euros (depending on the supplier of the product). How would I go about specifying the currency on a per-product basis in CartThrob?

I'm looking through the CartThrob settings but it seems geared up for specifying a single currency for the entire site.

1 Answer 1

2

You should be able to use the set config tag if you have two different price fields, e.g.

{exp:cartthrob:set_config}
{if euro_price_field}
{set_price_field channel="products" field="euro_price_field"}
{if:else}
{set_price_field channel="products" field="pounds_price_field"}
{/if}
{/exp:cartthrob:set_config}
3
  • Thanks for this. I take it that it's not possible to have a single Simple Price field (with the currency symbol removed), and to use a currency field in the set_config parameter to specify whether the price is in pounds or euros? For each product, I'll only ever set a single price anyway (pounds OR euros, but not both), so just double-checking I'm going to be going about this in the most efficient manner.
    – Stephen
    Dec 12, 2012 at 14:43
  • Well there's got to be some identifier that a price is pounds or euros otherwise how will the system know? It doesn't have to be a different price field, you could instead do set_config_name and change the number_formats_default_prefix and have the conditional check on a custom field or category so it knows which suppliers are which. But my concern would be what happens if you have products with two different currencies added to the same cart?
    – Tyssen
    Dec 12, 2012 at 22:09
  • Good point, thanks Tyssen.
    – Stephen
    Dec 12, 2012 at 23:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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