CanalWP

WooCommerce Brazilian Dots and Comma Separators

Dec 19th, 2015
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.54 KB | None | 0 0
  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);
Add Comment
Please, Sign In to add comment