近期有WooCommerce的項目中PayPal 報錯如下:
“Transaction Cancelled Error Message This function is temporarily unavailable. Please try your payment again later by returning to eBay and clicking the My eBay button.”
分析錯誤原因是因為WooCommerce使用了網(wǎng)址: website.com?cancel_order=true&order=order_number&order_id=160 而Paypal不支持此種調(diào)用方式。
解決方案如下:
1. 找到并打開文件: wp-content\plugins\woocommerce\includes\gateways\paypal\includes\class-wc-gateway-paypal-request.php
2. 查找這一行代碼
'cancel_return' => esc_url_raw( $order->get_cancel_order_url_raw() ),
替換為
'cancel_return' => urlencode( $order->get_cancel_order_url_raw() ),
搞定收工!:)