wc_get_price_thousand_separator
Allows you to change the thousands separator for prices.
The separator can also be changed in the admin area:
WooCommerce->Settings->General->Currency options
Usage
add_filter( 'wc_get_price_thousand_separator', 'wp_kama_wc_get_price_thousand_separator_filter' );
/**
* Function for `wc_get_price_thousand_separator` filter-hook.
*
* @param $option
*
* @return
*/
function wp_kama_wc_get_price_thousand_separator_filter( $option ){
// filter...
return $option;
}
- $option
- The separator saved in the admin area.
Examples
#1 Change the separator
add_filter( 'wc_get_price_thousand_separator', 'change_price_thousand_separator' );
function change_price_thousand_separator(){
return ' ';
}
echo wc_price( 15000 ); //> 15 000Changelog
| Since 2.3 | Introduced. |
Where the hook is called
wc_get_price_thousand_separator
woocommerce/includes/wc-formatting-functions.php 547
return stripslashes( apply_filters( 'wc_get_price_thousand_separator', get_option( 'woocommerce_price_thousand_sep' ) ) );
