Ecommerce Shopify WordPress Discussion

woocommerce_checkout_create_order hook not working

I'm working on a WooCommerce functionality within WordPress and have encountered an issue with the woocommerce_checkout_create_order hook. My aim is to execute a function during the order creation process, but it seems that the hook is not being triggered. Here is the code I am trying to implement: add_action('woocommerce_checkout_create_order', 'custom_checkout_field_update_order_meta', 1, 2); function custom_checkout_field_update_order_meta($order, $data) { error_log('test',print_r($order,true)); if (WC()->session->__isset('custom_form_data')) { $custom_data = WC()->session->get('custom_form_data'); $order->update_meta_data('_custom_form_data', $custom_data); $meta_data = $order->get_meta('_custom_form_data'); WC()->session->__unset('custom_form_data'); } else { } } I expected the line error_log('test', print_r($order, true)); to log information in the error logs, but there is no entry, suggesting that the woocommerce_checkout_create_order hook is not being triggered. Additional information: I am using the latest version of WooCommerce. Other error_log calls in my code work correctly. When I attach the same function to a simpler hook, like wp_footer, it works fine. I've also checked for conflicts with other plugins and themes, but the issue persists.
TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.