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 Garconis/ffbdf431e7a3bda296f24f6ddf190165 to your computer and use it in GitHub Desktop.
Save Garconis/ffbdf431e7a3bda296f24f6ddf190165 to your computer and use it in GitHub Desktop.
Gravity Forms | Update the USD currency input to remove decimals
<?php
// remove decimals (change) from Gravity Form's USD currency input
// reference: https://organicweb.com.au/wordpress/gravity-forms-price-rounding/
// useful info: https://docs.gravityforms.com/gform_currencies/
add_filter( 'gform_currencies', 'update_currency' );
function update_currency( $currencies ) {
$currencies['USD'] = array(
'name' => __( 'U.S. Dollar', 'gravityforms' ),
'symbol_left' => '$',
'symbol_right' => '',
'symbol_padding' => ' ',
'thousand_separator' => ',',
'decimal_separator' => '.',
'decimals' => 0
);
return $currencies;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment