WPML
apply_filters( 'wcml_product_price_by_currency', integer $product_id, string $currency )
ประเภท
filter
เวอร์ชันของ WooCommerce Multilingual
3.9

คำอธิบาย

  • ฮุกนี้จะคืนค่าราคาที่กำหนดเองหากมีการระบุไว้ มิฉะนั้นจะคืนค่าราคาตามอัตราแลกเปลี่ยนที่ตั้งไว้
  • ฮุกนี้ทำงานในส่วนหน้าเว็บไซต์เท่านั้น

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

$product_id
(integer) (จำเป็น) ID ของสินค้า
$currency
(string) (จำเป็น) รหัสสกุลเงินที่คุณต้องการดึงราคา เช่น “USD”, “EUR” เป็นต้น

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

ตัวอย่าง
 // Get the EUR price of the product ID = 80 
$product_id = 80; 
$currency = 'EUR'; 
echo apply_filters( 'wcml_product_price_by_currency', $product_id, $currency );
 
โปรดทราบ: โค้ดหลายสกุลเงินไม่ได้ถูกโหลดเสมอไป หากคุณพบว่าฟิลเตอร์นี้ไม่ทำงาน โปรดดูที่ฮุก wcml_load_multi_currency_in_ajax

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

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