For the complete documentation index, see llms.txt. This page is also available as Markdown.

Available YayCurrency Hooks

You can add these hooks to variables in template.php to alter the data that generates the switcher.

Custom Variable args in template.php

add_filter('yay_currency_switcher_template_args', 'yay_currency_switcher_template_args');
function yay_currency_switcher_template_args( $args ) {
    $args['is_show_flag'] = '0'; // if you don't want to show flag in Dropdown and otherwise '1'...Default: get value in settings.
    $args['is_show_currency_name'] = '0'; // if you don't want to show Currency name in Dropdown and otherwise '1'...Default: get value in settings.
    $args['is_show_currency_code'] = '0'; // if you don't want to show Currency code in Dropdown and otherwise '1'...Default: get value in settings.
    $args['switcher_size'] = 'large'; // custom switcher size ( small | large )
    //...
    return $args;
}

Custom currency code in Dropdown

add_filter('yay_currency_switcher_change_currency_code', 'yay_currency_custom_currency_code_dropdown_switcher');

function yay_currency_custom_currency_code_dropdown_switcher( $currency_code ) {
    return 'EUR' === $currency_code ? 'Eu' : $currency_code;
}

Custom wrapper switcher class in Dropdown

add_filter('yay_currency_switcher_class', 'yay_currency_custom_switcher_class_wrapper');

function yay_currency_custom_switcher_class_wrapper( $wrapper_class ) {
    $wrapper_class.= ' your-custom-class';
    return $wrapper_class;
}

Custom selected currency in Dropdown

Added : yay_currency_custom_currency_code_by_force_country hook, allow custom currency with force payment country

Added: filter hook hide dropdown/switcher in analytics

Added: filter hook yay_currency_convert_all_orders_to_base detect convert orders

Get cart subtotal by current currency: yay_currency_get_cart_subtotal

Get the shipping total by the current currency or fallback currency: yay_currency_get_shipping_total (PRO version only).

Get the total discount by the current currency or fallback currency: yay_currency_get_discount_total (PRO version only).

Get the total tax by the current currency: yay_currency_get_total_tax (PRO version only).

Get the total fee by current currency: yay_currency_get_fee_total (PRO version only).

Get the cart total by the current currency or fallback currency: yay_currency_get_cart_total (PRO version only).

Get the exchange rate for the current currency: yay_currency_rate

Customize the current currency based on your conditions: yay_currency_apply_currency

Customize the currency code: yay_currency_woocommerce_currency

Customize the currency symbol: woocommerce_currency_symbols

Customize the price format: yay_currency_custom_price_format

Customize product prices based on the current currency: yay_currency_get_price_by_currency

Added: yay_currency_by_country_code and yay_currency_by_billing_country_code are filter hooks to retrieve the currency based on the country code. (Pro version only)

Added: yay_currency_convert_price and yay_currency_revert_price are filter hooks to convert prices to the current currency and revert them to the default currency.

Added: yay_currency_product_price_with_caching filter hook support for the caching option. (Pro version only)

Change custom_flag

Added: yay_currency_will_not_round_shipping_cost filter hook to disable rounding of the shipping fee.

Added: filter hooks to allow custom currencies and change currency flags.

Show non-default currencies

Last updated

Was this helpful?