Add custom functionality on WooCommerce complete button

I’ve a situation to add some data to the database tables on order status completed button.
enter image description here

I can see the url in class-wc-admin-post-types.php

Read More

enter image description here

Can someone help me for any hook? Or how the admin-ajax.php works? I have to add status to some of mine custom database tables.

Related posts

1 comment

  1. this code will fire a customer’s order is set to completed..

    add_action( 'woocommerce_order_status_completed', 'custom_task' );
    function custom_task( $order_id ) {
    
        // Only continue if have $order_id
        if ( ! $order_id ) {
            return;
        }
    
        // Get order
        $order = wc_get_order( $order_id );
    
        // Do your thing
    
    }
    

Comments are closed.