Skip to content

Commit

Permalink
Added support for additional currencies
Browse files Browse the repository at this point in the history
  • Loading branch information
yashgit891 committed Jul 19, 2024
1 parent 6401a37 commit c2e0a95
Show file tree
Hide file tree
Showing 2 changed files with 563 additions and 0 deletions.
19 changes: 19 additions & 0 deletions razorpay.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,25 @@ public static function load()
GFAddOn::register('GFRazorpay');

add_filter('gform_currencies', function (array $currencies) {

$supported_currencies = json_decode(file_get_contents(__DIR__ . "/supported-currencies.json"), true)['supported-currencies'];

foreach ($supported_currencies as $k => $v)
{
if (in_array($v['iso_code'], $currencies) === false)
{
$currencies[$v['iso_code']] = array(
'name' => __( $v['currency_name'], 'gravityforms' ),
'code' => $v['iso_code'],
'symbol_left' => $v['iso_code'],
'symbol_right' => '',
'symbol_padding' => ' ',
'thousand_separator' => ',',
'decimal_separator' => '.',
'decimals' => $v['exponent']
);
}
}
$currencies['INR'] = array(
'name' => __( 'Indian Rupee', 'gravityforms' ),
'code' => 'INR',
Expand Down
Loading

0 comments on commit c2e0a95

Please sign in to comment.