Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
EDD 2.8 - Rial > Toman purchase link fix
<?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
You can’t perform that action at this time.