正在檢視 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 個帖子)
- 哎呀,回覆話題必需登入。