WPML
SignaturePHP
apply_filters( 'wcml_raw_price_amount', integer/float $price, string $currency )

Description

  • This filter should be used for filtering product/variations prices in general.
  • It is available on the front-end.

This filter is applied to the custom fields of products and variations that are used for prices (when they are read from the database):

  • _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

Arguments

  • $priceinteger/floatRequired

    The raw price in the default currency.
  • $currencystringOptional

    The currency code you want to convert the price into, e.g. “USD”, “EUR”, etc. If this parameter is not set, the current currency used on the front-end will be used.

Example Usage

PHP
/*
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