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 a dropdown selector, with flags [aelia_currency_selector_widget title="Widget title (optional)" widget_type="dropdown_flags"] // Render the widget with buttons [aelia_currency_selector_widget title="Widget title (optional)" widget_type="buttons"]
Arguments
- title
The widget title (optional). - widget_type
The widget type. The Currency Switcher supports the following widget types:- dropdown (default). A simple dropdown selector. By default, this widget will display the currency name (see argument "currency_display_mode" below.
- dropdown_flags. A dropdown selector, with flags displayed next to each currency. By default, this widget will display the currency codes. Note: this widget type is available since version 4.12.0 of the Aelia Currency Switcher.
- buttons. A selector showing buttons that visitors can click to select the currency. By default, this widget will display the currency codes.
- currency_display_mode
This argument specifies what label will be displayed for each currency. It can have the following values:- show_currency_code. Displays the currency code (e.g. EUR, GBP, USD).
- show_currency_name. Displays the currency name (e.g. Euro, Pound Sterling, Unites States Dollar).
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
- widget_type
Specifies the type of widget to be rendered. Accepted values: dropdown (default).
It's possible to specify custom widget types by following the instructions in our knowledge base: How can I customise the look and feel of the Billing Country Selector widget? - title (optional)
The widget title.
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>|price|regular_price|sale_price" 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. The following values can be passed to the shortcode:
- price
- regular_price
- sale_price
- sign_up_fee (applies only to subscription products)
If an invalid price type is specified, the shortcode will replace it with "price". - 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.