add_filter( 'wcml_rounded_price', 'the_callback_function', 10, 2 );
- ประเภท
- filter
- หมวดหมู่
- ฟีเจอร์หลายสกุลเงิน
- เวอร์ชันของ WooCommerce Multilingual
- 4.0.0
คำอธิบาย
- กรองราคาสกุลเงินที่สองหลังจากใช้กฎการปัดเศษ
- กฎเหล่านี้ตั้งค่าได้ที่หน้า WooCommerce -> WPML Multilingual & Multicurrency for WooCommerce ภายใต้แท็บ หลายสกุลเงิน
อาร์กิวเมนต์
มีพารามิเตอร์ 2 ตัวที่ส่งไปยังฟิลเตอร์นี้- $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