Home Calculations displaying 2 Currencies in WooCommerce Cart prices
Reply: 0

Calculations displaying 2 Currencies in WooCommerce Cart prices

user1193
1#
user1193 Published in June 20, 2018, 12:06 am
Rp 500000 (USD $ 37.49)

I want to show two currency looks like above in Cart Totals in woocommerce (subtotal, shipping, discount, insurance[custom fee], packing fee[custom fee]).

I succed make it on subtotal, shipping, discount with adding below filter.

But that doesn't work on the two custom fee (insurance, packing fee). When I add $price_us to the .woocommerce-Price-amount.amount class, the insurance/packing fee amount will going wrong. If I did not add $price_us to the .woocommerce-Price-amount.amount class everything will be ok, but with only 1 currency.

function my_custom_price_format( $formatted_price, $price, $decimals, 
  $decimal_separator, $thousand_separator ) {
  $price_us_int = intval(preg_replace('/[^0-9]+/', '', $price), 10);
  $price_us_int = convert_idr_to_usd_cart($price_us_int);

  $price_us = "USD $ $price_us_int";

  return '<span class="woocommerce-Price-amount amount">' . $formatted_price .' ( '.$price_us.' )</span>';
}
add_filter( 'formatted_woocommerce_price', 'my_custom_price_format', 20, 5 );

Is there anybody could help me with this situation.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.314044 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO