Skip to content

Instantly share code, notes, and snippets.

@cklosowski
Created July 27, 2017 21:34
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 cklosowski/173161869c6bae7e181a89adec8bab58 to your computer and use it in GitHub Desktop.
Save cklosowski/173161869c6bae7e181a89adec8bab58 to your computer and use it in GitHub Desktop.
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