如何在 Woocommerce 中将阿拉伯货币更改为英文货币? [英] How to change Arabic Currency into English Currency in Woocommerce?

查看:24
本文介绍了如何在 Woocommerce 中将阿拉伯货币更改为英文货币?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 WordPress Woocommerce.我的商店货币是沙特里亚尔,用阿拉伯语书写.我想将此阿拉伯语更改为英语,例如:SAR 或 SR.请告诉我它的解决方案.

这里是链接:

add_filter('woocommerce_currencies', 'add_my_currency');函数 add_my_currency( $currencies ) {$currencies['ABC'] = __('货币名称', 'woocommerce');返回 $currencies;}add_filter('woocommerce_currency_symbol', 'add_my_currency_symbol', 10, 2);函数 add_my_currency_symbol( $currency_symbol, $currency ) {开关($货币){case 'ABC': $currency_symbol = '$';休息;}返回 $currency_symbol;}

I am using WordPress Woocommerce. My store Currency is in Saudi Riyal which is write in Arabic language. I wanted to change this Arabic Language into English Language for example: SAR or SR. Please tell me solution of it.

Here is link: http://www.classic-polos.com/product/polo-basic/

And I have also attached screenshot of page. Screenshot of my Problem:

解决方案

the only way to display the letters in latin like it used to be before the WooCommerce update is to use the same old trick, even WPML won't help translating the currency in this case, just add a custom currency in the theme functions.php file as following:

Add a custom currency / symbol

add_filter( 'woocommerce_currencies', 'add_my_currency' );

function add_my_currency( $currencies ) {
     $currencies['ABC'] = __( 'Currency name', 'woocommerce' );
     return $currencies;
}

add_filter('woocommerce_currency_symbol', 'add_my_currency_symbol', 10, 2);

function add_my_currency_symbol( $currency_symbol, $currency ) {
     switch( $currency ) {
          case 'ABC': $currency_symbol = '$'; break;
     }
     return $currency_symbol;
}

这篇关于如何在 Woocommerce 中将阿拉伯货币更改为英文货币?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆