• Resolved diegpl

    (@diegpl)


    In woocommerce/includes/class-woocommerce.php this function is running without check if the user is a superadmin, which can break wpms big installations:

    if ( is_null( $this->customer ) || ! $this->customer instanceof WC_Customer ) {
    			$this->customer = new WC_Customer( get_current_user_id(), true );
    			//Customer should be saved during shutdown.
    		add_action( 'shutdown', array( $this->customer, 'save' ), 10 );
    		}

    Could you guys, please, implement this verification in the next versions? Tks! 😉

    
    if ( is_null( $this->customer ) || ! $this->customer instanceof WC_Customer ) {
    if (!is_super_admin() ) {
    $this->customer = new WC_Customer( get_current_user_id(), true );
    //Customer should be saved during shutdown.
    add_action( 'shutdown', array( $this->customer, 'save' ), 10 );
    }
    		}
Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter diegpl

    (@diegpl)

    Actually, the best approach would be to improve the query generated by the function, right? Tks! 😉

    SELECT umeta_id as meta_id, meta_key, meta_value
    FROM wp_usermeta
    WHERE user_id = 1
    ORDER BY umeta_id
    • This reply was modified 3 years ago by diegpl.
    Thread Starter diegpl

    (@diegpl)

    We could improve that getting just the meta_key value as _woocommerce_persistent_cart_websiteid, right? 🙂

    Plugin Support Paulo P – a11n

    (@paulostp)

    Hello @diegpl 👋

    Conversations about improvements to core code happen in the GitHub repository. Please open up an issue there, so the developer team and community can discuss it: https://github.com/woocommerce/woocommerce/issues

    I’ll go ahead and close this topic for now, thanks for raising the issue!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Cart initializing for superadmin querying many rows’ is closed to new replies.