Created
January 22, 2021 16:35
-
-
Save Garconis/ffbdf431e7a3bda296f24f6ddf190165 to your computer and use it in GitHub Desktop.
Gravity Forms | Update the USD currency input to remove decimals
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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