• Resolved carloscastro7

    (@carloscastro7)


    I’m trying to add the following PHP code snippet:

    /**
     * Auto Complete all WooCommerce orders.
     */
    add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_complete_order' );
    function custom_woocommerce_auto_complete_order( $order_id ) { 
        if ( ! $order_id ) {
            return;
        }
    
        $order = wc_get_order( $order_id );
        $order->update_status( 'completed' );
    }

    But I get the following error: Could not create snippet. The server did not send a valid response.

    Here’s the console output:

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

The topic ‘Could not create snippet. The server did not send a valid response.’ is closed to new replies.