So even if I try to inline the style code it is the same result, but it is fine I tried to modify the CSS style of those effected elements.
And I tried to adjust the code that you provided and now it works flawless.
Also this line has issues: “$centavos_str = str_pad( $centavos, 2, ‘0’ )”
Here it is: (for USD)
<?php
// WooCommerce - show cents within a class so they can be a smaller font
// USD
add_filter( 'wc_price', 'my_price', 3, 60 );
function my_price( $return, $price, $args ) {
// $return = price with currency symbol
// $price = price as a number
// $args = array (inc tax, exc tax)
$usd = intval( $price );
$centavos = ( $price - $usd ) * 100;
$centavos_int = intval( $centavos );
return '$'.$usd.'.<span class="centavos">'.$centavos_int.'</span>';
}
?>
// Custom CSS:
.centavos {
font-size: 75%;
}
I also find out that if in WooCommerce settings you have “,” as a “Thousand Separator” it won’t work when product price or total price goes 1000 and up ( it will show you $1 not $1000 ) so I tried a quick fix by removing (Thousand Separator “,”) in settings and now everything works fine.
Thank you so much dear for your support.