WPML
add_filter( 'wcml_rounded_price', 'the_callback_function', 10, 2 );
유형
filter
카테고리
다중 통화 기능
WooCommerce Multilingual 버전
4.0.0

설명

  • 반올림 규칙을 적용한 후 두 번째 통화 가격을 필터링합니다.
  • 이 규칙은 WooCommerce -> WPML Multilingual & Multicurrency for WooCommerce 페이지의 다중 통화 탭에서 설정합니다.

인수

이 필터에는 두 개의 매개변수가 전달됩니다.
$price
(integer) 반올림 규칙을 적용한 후의 가격입니다.
$currency
(string) 두 번째 통화 코드입니다(예: “USD”, “EUR” 등).

사용 예시

예시
/*
 * Add this code to the functions.php file of your theme.
 *
 * Assume: 
 * USD = the default currency
 * EUR = the second currency
 */
  
add_filter( 'wcml_rounded_price', 'wcmlhook_rounded_price', 10, 2 );

function wcmlhook_rounded_price( $price, $currency ) {
	if ( 'EUR' == $currency ) {
		$price = $price + 0.99; // Add 99 cents to all rounded prices
	}

	return $price;
}

wcml_custom_prices_fields_labels, wcml_is_cache_enabled_for_switching_currency, wcml_geolocation_get_user_country, wcml_user_store_strategy, wcml_currencies_without_cents, wcml_product_custom_prices, wcml_custom_prices_strings, wcml_switch_currency, wcml_custom_prices_fields, wcml_multi_currency_ajax_actions

모든 다중 통화 기능 훅 24개 →