Update 2 Only For Woocommerce 3+ (added restriction to execute the code only once). add_action('woocommerce_thankyou', 'enroll_student' ...
[This thread is closed.] Hi all, I need to catch the order creation but I have some problems: 1) if I add woocommerce_new_order hook, and I retrieve…
You can use woocommerce_new_order hook: add_action(' woocommerce_new_order', function ($order_id) { // your code }, 10, 1);.
Try woocommerce_thankyou hook. This will trigger after recieving order successfully, no matter how user made payment. $hook_to = ' woocommerce_thankyou' ...
Topic: Indicate when the webhook should be triggered – Order Created, Product Deleted, or Customer Updated. There are also Action and Custom options.
WooCommerce Code Reference
Add a new field to the checkout; Add that new field to the order.
How to Hook Into WooCommerce to Trigger Something After an Order is Placed - Andy Sozot.
$ renewal_order A WC_Order object representing the order created to record the ...
However, before a payment is made and after a checkout is place, an order is created. This hook is often ignored and not mention around. And this is the ...