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.

List of all Google Adsense, VueJS, AngularJS, PHP, Laravel Examples.

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.

Related FAQ

Here are some more FAQ related to this Article:

  1.   How to Integration PayPal Payment Gateway in PHP?
  2.   ccavenue payment gateway integration in php demo
  3.   PHP Codeigniter Image File Upload
  4.   Load web pages iframe using jQuery Example
  5.   Simple Create WordPress Plugin Tutorial
  6.   jquery empty/null json object Example
  7.   PayPal Payment Gateway with PHP MySQL Database
  8.   Wordpress Plugin uninstall hook - register_uninstall_hook()
  9.   Angular 7|8|9 Validate Mobile number With 10 Digits Example
  10.   PHP Ajax Display Dynamic MySQL Data in Bootstrap Modal

Leave a Reply

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