Available YayCurrency Hooks

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

  1. 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;
}
  1. 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;
}
  1. Add 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;
}
  1. Custom selected currency in Dropdown

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

  1. Added: filter hook hide dropdown/switcher in analytics

  1. Added: filter hook yay_currency_convert_all_orders_to_base detect convert orders

  1. Get cart subtotal by current currency: yay_currency_get_cart_subtotal

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

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

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

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

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

  1. Get the exchange rate for the current currency: yay_currency_rate

  1. Customize the current currency based on your conditions: yay_currency_apply_currency

  1. Customize the currency code: yay_currency_woocommerce_currency

  1. Customize the currency symbol: yay_currency_woocommerce_currency_symbol

  1. Customize the price format: yay_currency_custom_price_format

  1. Customize product prices based on the current currency: yay_currency_get_price_by_currency

  1. 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)

  1. 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.

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

  1. Change custom_flag

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

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

Last updated

Was this helpful?