This article lists the shortcodes provided by the Aelia Currency Switcher for WooCommerce, and how to use them.


1. aelia_currency_selector_widget

Renders the currency selector widget.


Usage

// Render the widget with a dropdown selector
[aelia_currency_selector_widget title="Widget title (optional)" widget_type="dropdown"]
// Render the widget with buttons
[aelia_currency_selector_widget title="Widget title (optional)" widget_type="buttons"]

Arguments


2. aelia_cs_country_selector_widget
Renders the country selector widget, when the "force currency by billing country" option is enabled.

Usage 
[aelia_cs_country_selector_widget title="Widget title (optional)" widget_type="dropdown"]

Arguments


Shortcodes available in Currency Switcher 4.x and newer


3. aelia_cs_product_price
Displays the price of a product in the active currency, or in a specific currency.

Usage
[aelia_cs_product_price product_id="123" price_type="<empty>|regular|sale" formatted="0|1" currency="<empty>|<currency code>" show_full_html_price="0|1"]

Arguments

  • product_id
    The ID of the product whose price will be displayed.
  • price_type (optional)
    Specifies which price should be displayed. Accepted values: regular, sale. If omitted, the product's final price is displayed (i.e. the one that the customer will pay).
  • formatted (optional)
    Specifies if the price should be formatted, with currency symbol and thousand separator (e.g. $1,234.56). If omitted, or set to zero, the price will be returned as a raw value (e.g. 1234.56).
  • currency (optional)
    If specified, the product price will be converted to that currency (if such currency is enabled in Currency Switcher Options). When omitted, the price will be displayed in the active currency.
  • show_full_html_price (optional)
    If specified, the shortcode will render the full price of the product, eventually showing both the final price and the sale price, just like WooCommerce does on the catalogue (e.g. $1,234.56 $3,456.78).

4. aelia_cs_currency_amount

Converts an arbitrary amount from one currency to another and displays it.


Usage    

[aelia_cs_currency_amount amount="123.45"  formatted="0|1" from_currency="<empty>|<currency code>" to_currency="<empty>|<currency code>" decimals="<empty>|<number of decimals>" EUR="<amount_in_EUR>" GBP="amount_in_GBP"]

Arguments

  • amount
    The amount to be converted.
  • from_currency (optional)
    Specifies the currency of the amount entered in the shortcode. If omitted, shop's base currency is used.
  • to_currency (optional)
    Specifies the currency to which the amount will be converted. If omitted, the active currency is used.
  • formatted (optional)
    Specifies if the price should be formatted, with currency symbol and thousand separator (e.g. $1,234.56). If omitted, or set to zero, the price will be returned as a raw value (e.g. 1234.56).
  • decimals (optional)
    The converted amount will be rounded to the specified amount of decimals. If omitted, this value will be taken from the Currency Switcher settings.
  • EUR, GBP, etc (optional)
    The shortcode allows to enter amounts to be used for specific currencies. When an explicit value is set for a currency, such value is taken automatically, instead of converting the original amount.

    Example 
    [aelia_cs_currency_amount amount="123.45"  from_currency="USD" EUR="456.78" GBP="789.11"]
    This shortcode will display the following values:

    - 123.45 USD
    - 456.78 EUR (explicit value set for EUR)
    - 789.11 GBP (explicit value set for GBP)
    167.47 AUD (i.e. 123.45 USD converted to AUD)


You can purchase the Currency Switcher from our online shop.