Event Tickets Plus – Completing WooCommerce Orders Automatically

Problem: Have to manually change Status of WooCommerce Orders from Processing to Completed so that Event Tickets Plus QR codes in customer’s email can be activated and scannable with the Event Tickets Plus Check-In App.

When purchasing tickets with Event Tickets Plus, emails won’t be sent to attendees until the order has been marked as Complete, when using WooCommerce. By default, this is a process that needs to be done manually by the administrator.

Completing WooCommerce Orders – The Events Calendar

Solution: Use Action Hook to automatically set the WooCommerce Order Status to Completed.

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

Source: Completing WooCommerce Orders – The Events Calendar

I used Code Snippets WordPress plugin to add the Action Hook PHP code to the site.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *