WPML
SignaturePHP
apply_filters( 'wcml_product_price_by_currency', integer $product_id, string $currency )

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_idintegerRequired

    The product ID
  • $currencystringRequired

    The currency code you want to get the price for, e.g. “USD”, “EUR”, etc.

Example Usage

PHP
 // 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.