WPML
add_filter( 'wcml_custom_prices_strings', 'the_callback_function', 10, 2 );
ประเภท
filter
เวอร์ชันของ WooCommerce Multilingual
3.8

คำอธิบาย

แก้ไขสตริงที่ใช้ในส่วน กำหนดราคาในสกุลเงินอื่นด้วยตนเอง

อาร์กิวเมนต์

มีพารามิเตอร์สองตัวที่ส่งไปยังฟิลเตอร์นี้:
$strings
(array) อาร์เรย์สตริงข้อความที่ใช้ในส่วนของราคาแบบกำหนดเอง ซึ่งมีลักษณะดังต่อไปนี้:
array( 'not_set' => sprintf( __( 'Multi-currency is enabled but no secondary currencies have been set. %sAdd secondary currencies%s.', 'woocommerce-multilingual' ), '', '' ), 'calc_auto' => __( 'Calculate prices in other currencies automatically', 'woocommerce-multilingual' ), 'see_prices' => __( 'Click to see the prices in the other currencies as they are currently shown on the front end.', 'woocommerce-multilingual' ), 'show' => __( 'Show', 'woocommerce-multilingual' ), 'hide' => __( 'Hide', 'woocommerce-multilingual' ), 'set_manually' => __( 'Set prices in other currencies manually', 'woocommerce-multilingual' ), 'enter_prices' => __( 'Enter prices in other currencies', 'woocommerce-multilingual' ), 'hide_prices' => __( 'Hide prices in other currencies', 'woocommerce-multilingual' ), 'det_auto' => __( 'Determined automatically based on exchange rate', 'woocommerce-multilingual' ), '_regular_price' => __( 'Regular Price', 'woocommerce-multilingual' ), '_sale_price' => __( 'Sale Price', 'woocommerce-multilingual' ), 'schedule' => __( 'Schedule', 'woocommerce-multilingual' ), 'same_as_def' => __( 'Same as default currency', 'woocommerce-multilingual' ), 'set_dates' => __( 'Set dates', 'woocommerce-multilingual' ), 'collapse' => __( 'Collapse', 'woocommerce-multilingual' ), 'from' => __( 'From…', 'woocommerce-multilingual' ), 'to' => __( 'To…', 'woocommerce-multilingual' ), 'enter_price' => __( 'Please enter in a value less than the regular price', 'woocommerce-multilingual' ) )
$product_id
(integer) ID ของผลิตภัณฑ์ต้นฉบับ

ตัวอย่างการใช้งาน

ตัวอย่าง
/**
 * Add this code to the functions.php file of your theme.
 */

add_filter( 'wcml_custom_prices_strings', 'set_labels_for_price_fields', 10, 2 );
function set_labels_for_price_fields( $strings, $product_id ){

    // Change the default text "Show" to "Display"
    $strings[ 'show' ] = __( 'Display', 'woocommerce-multilingual' ); 

    return $strings;

}

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_switch_currency, wcml_custom_prices_fields, wcml_multi_currency_ajax_actions

ฮุก ฟีเจอร์หลายสกุลเงิน ทั้งหมด 24 รายการ →