WooCommerce 中生成空白订单,没有详细信息且处于待付款状态,

问题描述 投票:0回答:1

WooCommerce 中生成空白订单,没有详细信息且处于待付款状态,

我正在使用 woocommerce 插件和 elavon payment getaway 一切设置都正常,但订单是自动生成的! 每秒都会生成空白订单 请指导我如何解决这个问题

https://prnt.sc/IZQFNE5t_-yV

https://prnt.sc/IZQFNE5t_-yV

css wordpress woocommerce plugins status
1个回答
0
投票

我发现 src/abstract-wc-gateway-elavon-converge.php 中的代码特别是函数 get_order_for_add_ payment_method() 在用户登录时创建一个新订单。因此,作为补丁,我只是注释掉了这些行(434- 437),如果没有这个功能,它似乎也能正常工作。如果您保存付款方式,它可能会影响功能,但我已在设置中禁用该功能。

// get_order_for_add_payment_method() assumes there is a logged in user
// if ( is_user_logged_in() ) {
//  return $this->get_order_for_add_payment_method();
// }

---> 这是创建空白订单的地方(class-sv-wc- payment-gateway-direct.php

protected function get_order_for_add_payment_method() {

    // mock order, as all gateway API implementations require an order object for tokenization

    $order = new \WC_Order( 0 ); //Creates NEW order!

    $order = $this->get_order( $order );

    $user = get_userdata( get_current_user_id() );

    $properties = [
        'currency'    => get_woocommerce_currency(), // default to base store currency
        'customer_id' => $user->ID,
    ];

希望这有帮助。

© www.soinside.com 2019 - 2024. All rights reserved.