woocommerce_payment_complete Hooks

The woocommerce_payment_complete hook is run or trigger when the WooCommerce payment is completed. The only single variable passed is the order id, or order details, though from that you can get and the Main fetch data of the order object, as well as ultimately the user.

WooCommerce payment complete hook

The simple way to learn WordPress Core woocommerce payment complete hook with Hook Parameters, Usage, Defined, run add and remove Example.

Also Read : Woocommerce Product publish, update and delete hooks

Example of woocommerce_payment_complete

add_action( 'woocommerce_payment_complete',  $callable,  $int,  $int ); 

Parameters (3)

1 - $callable (unknown)
The callable.
2 - $int (int) => 10
The int.
3 - $int (int) => 1
The int.


To run add and remove the woocommerce hook, simply you can copy the example below line.

  • run the action
  • add the action
  • remove the action

run the action

do_action( 'woocommerce_payment_complete', $callable, $int, $int ); 

add the action

The following example is for adding a woocommerce hook callback. as well as define the woocommerce_payment_completes callback and add the action.

function userDefineFunForPaymentComplete( $callable, $int, $int ) { 
    // create a action logic happen here... 
add_action( 'woocommerce_payment_complete', 'userDefineFunForPaymentComplete', 10, 3 ); 

remove the action

To remove/delete a woocommerce hook callback, use the example below.

remove_action( 'woocommerce_payment_complete', 'userDefineFunForPaymentComplete', 10, 3 ); 

Defined (1)

The action is defined in the following location(s).

add_action( 'woocommerce_payment_complete', $callable, 10, 1 ); 

Also Read : SKT IT Consultant WordPress theme By SKT Themes

Example of woocommerce hook

add_action( 'woocommerce_payment_complete', 'userDefineFunForPaymentComplete' );
function userDefineFunForPaymentComplete( $order_id ){
    $get_order = wc_get_order( $order_id );
    $user = $get_order->get_user();
    if( $user ){
        // create a action do something your Logic with the user

I hope you get an idea about woocommerce product hooks.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment