I am creating a payment gateway for woocommerce but I am facing an issue that after successful payment I am redirecting to thank you page and my order status is not updating to ‘processing’ or ‘completed’.

I am using woocommerce_thankyou hook in my plugins main file.

add_action( 'woocommerce_thankyou_epg', 'my_change_status_function', 10, 1 );

    function my_change_status_function( $order_id ) {

        $order = new WC_Order( $order_id );
        $order->update_status( 'processing', __( 'Payment received.', 'wc-gateway-offline' ) );


Actually in this functions before updating the status I want to send a API call to check the status of the payment and than according to the response I want to update the status of the order.

Can anybody help me in sorting this out.

Read more here: woocommerce_thankyou hook is not working after successful payment


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: