正在查看 5 个帖子:1-5 (共 5 个帖子)
-
作者帖子
-
启用后,提示
PayPal 不支持你的商店货币。
另外如何设置 PAYPAL 和当前的货币的汇率
将下面的两段代码添加到你的子主题 functions.php 文件里。给你们的多站点站群安装了代码段插件,也可以复制进去,然后再对应的站中启用。
//WooCommerce 中文网关支持 PayPal //本函数解决的问题:贝宝不支持你的商铺货币。 Gateway Disabled: PayPal does not support your store's currency. add_filter( 'woocommerce_paypal_supported_currencies', 'enable_custom_currency' ); function enable_custom_currency($currency_array) { $currency_array[] = 'CNY'; return $currency_array; }
//WooCommerce 美元人民币转换,汇率可以自己定义 add_filter('woocommerce_paypal_args', 'convert_rmb_to_usd'); function convert_rmb_to_usd($paypal_args){ if ( $paypal_args['currency_code'] == 'CNY'){ $convert_rate = 6.7; //Set converting rate $count = 1; while( isset($paypal_args['amount_' . $count]) ){ $paypal_args['amount_' . $count] = round( $paypal_args['amount_' . $count] / $convert_rate, 2); $count++; } } return $paypal_args; }
1. 是插入两个代码段,还是一个即可。
2. 请问是在哪一个插入呢?
- 在任何地方运行片段
- 只在管理区运行
- 仅在站点前台运行
- 只运行一次
两个都要 ,然后 仅在站点前台运行
-
作者帖子
正在查看 5 个帖子:1-5 (共 5 个帖子)
- 哎呀,回复话题必需登录。