- availability:
-
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.
- type:
- filter
- category:
- Multi-currency Feature
- parameters:
-
apply_filters( 'wcml_product_price_by_currency', integer $product_id, string $currency )
- $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.
- hook 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.