Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 130709

Display 2 price in woocommerce

$
0
0

Replies: 0

the following code display the product price twice

add_filter( ‘woocommerce_get_price_html’, ‘euros_custom_price’, 100, 2 );

function euros_custom_price( $price, $product ){
$price = ‘XPF ‘ . $price . ‘ (EUROS ‘ . $price . ‘)’;
return apply_filters( ‘woocommerce_get_price’, $price );
}

I would like to have the price in euros calculate on the $price with 2 decimals

$euros = $price * 0.008352
so for example is $price = 1000 the $euros should be 8.35

I don’t know how to integrate the multiplication into the following code

add_filter( ‘woocommerce_get_price_html’, ‘euros_custom_price’, 100, 2 );

function euros_custom_price( $price, $product ){
$price = ‘XPF ‘ . $price . ‘ (EUROS ‘ . $euros . ‘)’;
return apply_filters( ‘woocommerce_get_price’, $price );
}


Viewing all articles
Browse latest Browse all 130709

Trending Articles