Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save rashmimalpande/c65262e23c5f77df726fc03fcd43ccb2 to your computer and use it in GitHub Desktop.

Select an option

Save rashmimalpande/c65262e23c5f77df726fc03fcd43ccb2 to your computer and use it in GitHub Desktop.
<?php
add_filter( 'formatted_woocommerce_price', 'ts_woo_decimal_price', 10, 5 );
function ts_woo_decimal_price( $formatted_price, $price, $decimal_places, $decimal_separator, $thousand_separator ) {
$unit = number_format( intval( $price ), 0, $decimal_separator, $thousand_separator );
$decimal = sprintf( '%02d', ( $price - intval( $price ) ) * 100 );
return $unit . '<sup>' . $decimal_separator. $decimal . '</sup>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment