WPML
apply_filters( 'wcml_product_price_by_currency', integer $product_id, string $currency )
Type
filter
WooCommerce Multilingual Version
3.9

Description

  • This hook returns the custom price if entered. Otherwise, it returns the price based on the set exchange rate.
  • This hook works only on the front-end.

Arguments

$product_id
(integer) (Required) The product ID
$currency
(string) (Required) The currency code you want to get the price for, e.g. “USD”, “EUR”, etc.

Example usage

Example
 // Get the EUR price of the product ID = 80 
$product_id = 80; 
$currency = 'EUR'; 
echo apply_filters( 'wcml_product_price_by_currency', $product_id, $currency );
 
Please note: Multicurrency code is not always loaded. If you find that this filter is not working, please take a look at the wcml_load_multi_currency_in_ajax hook.

wcml_custom_prices_fields_labels, wcml_is_cache_enabled_for_switching_currency, wcml_geolocation_get_user_country, wcml_user_store_strategy, wcml_rounded_price, wcml_currencies_without_cents, wcml_product_custom_prices, wcml_custom_prices_strings, wcml_switch_currency, wcml_custom_prices_fields

All 24 Multi-currency Feature hooks →