Skip Navigation
availability:

WooCommerce Multilingual Version: 4.0.0

description:
  • Filter second currency prices after applying rounding rules.
  • These rules are set on the WooCommerce -> WooCommerce Multilingual page, under the Multi-currency tab.
type:
filter
category:
Multi-currency Feature
parameters:
add_filter( 'wcml_rounded_price', 'the_callback_function', 10, 2 );

There are two parameters passed to this filter:

$price
(integer) The price after applying rounding rules.
$currency
(string) The second currency code, e.g. “USD”, “EUR”, etc.
hook example usage:

Example

/*
 * Add this code to the functions.php file of your theme.
 *
 * Assume: 
 * USD = the default currency
 * EUR = the second currency
 */
  
add_filter( 'wcml_rounded_price', 'wcmlhook_rounded_price', 10, 2 );

function wcmlhook_rounded_price( $price, $currency ) {
	if ( 'EUR' == $currency ) {
		$price = $price + 0.99; // Add 99 cents to all rounded prices
	}

	return $price;
}