WPML
apply_filters( 'wcml_formatted_price', integer/float $price, string $currency )
タイプ
filter
カテゴリー
多通貨機能
WooCommerce Multilingualバージョン
3.5

説明

正しいフォーマットを使用して、デフォルト通貨の価格を選択した通貨に変換します。

引数

$price
(integer/float) (必須) デフォルト通貨の元の価格です。
$currency
(文字列) (オプション) 価格の変換先となる通貨コードです(例: 「USD」、「EUR」など)。このパラメーターが設定されていない場合、フロントエンドで使用されている現在の通貨が使用されます。

使用例

/*
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

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

すべての多通貨機能フック(24件) →