SHARE
TWEET

WooCommerce Brazilian Dots and Comma Separators

CanalWP Dec 19th, 2015 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function site_woocommerce_get_price($price, $product) {
  2.     $decimal_sep = wp_specialchars_decode(stripslashes(get_option('woocommerce_price_decimal_sep')), ENT_QUOTES);
  3.  
  4.     if ($decimal_sep != '.') {
  5.         $thousands_sep = wp_specialchars_decode(stripslashes(get_option( 'woocommerce_price_thousand_sep')), ENT_QUOTES);
  6.  
  7.         $price = str_replace($thousands_sep, '', $price);
  8.         $price = str_replace($decimal_sep, '.', $price);
  9.     }
  10.  
  11.     return $price;
  12. }
  13. add_filter('woocommerce_get_price', 'site_woocommerce_get_price', 10, 2);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top