I am looking for a hook which will be triggered after someone submit checkout form and order placed ( no matter he made the payment or not ) .

I tried woocommerce_new_order

But it's not working.

closed as off-topic by TheDeadMedic, Mark Kaplun, Mayeenul Islam, Howdy_McGee, s_ha_dum Dec 24 '15 at 22:33

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

  • Post your code that's not working. – montrealist Dec 19 '15 at 19:31
  • function action_woocommerce_new_order( $order_id ) { update_option('new_order', $order_id ); }; add_action( 'woocommerce_payment_complete', 'action_woocommerce_new_order', 10, 1 ); – Ifty Dec 19 '15 at 19:47

Try woocommerce_thankyou hook. This will trigger after recieving order successfully, no matter how user made payment.

$hook_to = 'woocommerce_thankyou';
$what_to_hook = 'wl8OrderPlacedTriggerSomething';
$prioriy = 111;
$num_of_arg = 1;    
add_action($hook_to, $what_to_hook, $prioriy, $num_of_arg);

function wl8OrderPlacedTriggerSomething($order_id){
      //do something...

For more reference dig into woocommerce/templates/checkout/thankyou.php

  • 2
    Note: this event will be triggered again if the end user refreshes the thank you page for whatever reason. – Vivek Athalye Dec 23 '17 at 12:27
  • 1
    Is there a hook that only works on save? – benedict_w Oct 24 '18 at 12:59

I found the solution. An old order already exists in my order list. So when I am adding new items in order, woocommerce just updating my old unpaid order. So I use woocommerce_resume_order action too. Now it's fine.

Not the answer you're looking for? Browse other questions tagged or ask your own question.