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