且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Woocommerce:支付网关自定义感谢页面

更新时间:2023-12-01 16:53:52

认为您需要定位的过滤器是woocommerce_payment_successful_result,它位于WC_Checkout代码> 类.

I think the filter you need to target is woocommerce_payment_successful_result which is in the WC_Checkout class.

function so_27024470_paypal_redirect( $return, $order_id ){
    $order = new WC_Order( $order_id );
    if( $order->payment_method == 'your-gateway-id' ){
        $return['redirect'] = 'http://your-redirect.com';
    }
    return $return;
}
add_action( 'woocommerce_payment_successful_result, 'so_27024470_paypal_redirect', 10, 2 );

我没有测试过这个,所以使用风险自负.

I haven't tested this, so use at your own risk.