apply_filters( 'wcml_raw_price_amount', integer/float $price, string $currency )
- 유형
- filter
- 카테고리
- 다중 통화 기능
- WooCommerce Multilingual 버전
- 3.5
설명
- 기본 통화의 원본 가격을 선택한 통화로 변환합니다.
- 이 필터는 일반적으로 상품/옵션 가격을 필터링하는 데 사용해야 합니다.
- 프런트엔드에서 사용할 수 있습니다.
이 필터는 가격에 사용되는 상품 및 옵션의 사용자 정의 필드에 적용됩니다(데이터베이스에서 읽을 때):
- _price
- _regular_price
- _sale_price
- _min_variation_price
- _min_variation_price_regular_price
- _mix_variation_price_sale_price
- _max_variation_price
- _max_variation_price_regular_price
- _max_variation_price_sale_price
인수
- $price
- (integer/float) (필수) 기본 통화의 원본 가격입니다.
- $currency
- (문자열) (선택 사항) 가격을 변환할 통화 코드입니다(예: “USD”, “EUR” 등). 이 매개변수를 설정하지 않으면 프런트엔드에서 사용하는 현재 통화가 사용됩니다.
사용 예시
예제
/*
Assume:
* USD = the default currency
* EUR = the second currency
* 0.8 = the exchange rate USD / EUR
*/
$price = 100;
$currency = "EUR";
$new_price = apply_filters('wcml_raw_price_amount', $price, $currency);
echo $new_price; // Return 80
관련 훅
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