vikas Singh
vikas Singh

Reputation: 21

blank orders being generated in WooCommerce with no details and a pending payment status,

blank orders being generated in WooCommerce with no details and a pending payment status,

i am using woocommerce plugin and elavon payment getaway everything setup is ok but the order are automatic generated ! every second the blank orders are generated Please guide how do i fix the issue

https://prnt.sc/IZQFNE5t_-yV

https://prnt.sc/IZQFNE5t_-yV

Upvotes: -2

Views: 857

Answers (1)

Sasha K
Sasha K

Reputation: 36

I found that the code in src/abstract-wc-gateway-elavon-converge.php specifically function get_order_for_add_payment_method() creates a new order if the user is logged in. So as a patch, I just commented out these lines (434-437), and it seemed to work fine without that function. It could affect the functionality if you are saving payment methods, but I have disabled that functionality in settings.

// 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();
// }

---> This is where the blank orders get created (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,
    ];

Hope this helps.

Upvotes: 2

Related Questions