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