Skip Navigation
availability:

WooCommerce Multilingual Version: 3.5

description:
  • Convert the raw price in the default currency into the selected currency.
  • 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
type:
filter
category:
Multi-currency Feature
parameters:
apply_filters( 'wcml_raw_price_amount', integer/float $price, string $currency )
$price
(integer/float) (Required) The raw price in the default currency.
$currency
(string) (Optional) 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.
hook example usage:

Example

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