WPML
apply_filters( 'wcml_product_price_by_currency', integer $product_id, string $currency )
Tipo
filter
Versione di WooCommerce Multilingual
3.9

Descrizione

  • Questo hook restituisce il prezzo personalizzato se inserito. Altrimenti, restituisce il prezzo in base al tasso di cambio impostato.
  • Questo hook funziona solo sul front-end.

Argomenti

$product_id
(intero) (Obbligatorio) L’ID del prodotto
$currency
(stringa) (Obbligatorio) Il codice della valuta per cui desideri ottenere il prezzo, ad es. “USD”, “EUR”, ecc.

Esempio di utilizzo

Esempio
 // 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 );
 
Nota bene: il codice Multivaluta non è sempre caricato. Se noti che questo filtro non funziona, dai un’occhiata all’hook 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

Tutti i 24 hook della categoria Funzionalità multivaluta →