Created
July 27, 2017 21:34
-
-
Save cklosowski/173161869c6bae7e181a89adec8bab58 to your computer and use it in GitHub Desktop.
EDD 2.8 - Rial > Toman purchase link fix
This file contains hidden or 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 | |
if ( ! function_exists( 'edd_toman_currency_symbol' ) ) { | |
function edd_toman_currency_symbol( $symbol, $currency ) { | |
if ( ! is_admin() && 'rial' === strtolower( $currency ) ) { | |
return 'تومان'; | |
} | |
return 'ریال'; | |
} | |
} | |
add_filter( 'edd_currency_symbol', 'edd_toman_currency_symbol', 10, 3 ); | |
if ( ! function_exists( 'edd_toman_currency_amount' ) ) { | |
function edd_toman_currency_amount( $formatted, $amount, $decimals, $decimal_sep, $thousands_sep ) { | |
$currency = edd_get_currency(); | |
if ( ! is_admin() && 'rial' === strtolower( $currency ) ) { | |
$formatted = @str_replace( ',', '', $formatted ); | |
$formatted = @$formatted / 10; | |
} | |
return $formatted; | |
} | |
} | |
add_filter( 'edd_format_amount', 'edd_toman_currency_amount', 10, 5 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment