Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save attilabacso/fe3b53527cd4e396900be717a767d4bf to your computer and use it in GitHub Desktop.
Save attilabacso/fe3b53527cd4e396900be717a767d4bf to your computer and use it in GitHub Desktop.
// Put functions.php
add_filter('give_format_amount', 'give_remove_thousands_seperator');
function give_remove_thousands_seperator($amount, $decimals = true) {
$thousands_sep = '';
$decimal_sep = give_get_option( 'decimal_separator', '.' );
if ( empty( $amount ) ) {
$amount = 0;
} else {
// Sanitize amount before formatting.
$amount = give_sanitize_amount( $amount );
}
$decimals = $decimals ? give_get_price_decimals() : 0;
$formatted = number_format( $amount, $decimals, $decimal_sep, $thousands_sep );
return $formatted;
}
add_filter('give_global_script_vars', 'give_remove_thousands_js_autoformatting');
function give_remove_thousands_js_autoformatting($args) {
$args['thousands_separator'] = '';
return $args;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment