近期有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使用了网址: website.com?cancel_order=true&order=order_number&order_id=160 而Paypal不支持此种调用方式。
    解决方案如下:

    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() ),
    

    搞定收工!:)