Skip Navigation
availability:

WooCommerce Multilingual Version: 3.5

description:

Convert a default currency price to the selected currency, using the correct format.

type:
filter
category:
Multi-currency Feature
parameters:
apply_filters( 'wcml_formatted_price', integer/float $price, string $currency )
$price
(integer/float) (Required) The raw price in the default currency.
$currency
(string) (Optional) The currency code you want to convert the price into, e.g. “USD”, “EUR”, etc. If this parameter is not set, the current currency used on the front-end will be used.
hook example usage:

Example

/*
Assume: 
 * EUR = the default currency
 * USD = the second currency
 * 1.2 = the exchange rate EUR / USD 
*/ 

$price = 1234.56;
$currency = 'USD';
$formatted_price = apply_filters( 'wcml_formatted_price', $price, $currency );

echo $formatted_price; // Return $1,481.47