Title: Problem with plugin which uses specific hook
Last modified: November 10, 2021

---

# Problem with plugin which uses specific hook

 *  Resolved [lolitsjohnnyboy](https://wordpress.org/support/users/lolitsjohnnyboy/)
 * (@lolitsjohnnyboy)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/problem-with-plugin-which-uses-specific-hook/)
 * Hi,
 * a customer from us uses our plugin which uses the following hook to do some actions,
   including an output of the order number:
 *     ```
       add_action( 'woocommerce_checkout_order_processed', 'woocommerce_checkout_order_processed_action' );
       function woocommerce_checkout_order_processed_action( int $order_id ) {
       	$order        = wc_get_order( $order_id );
       	$order_number = $order->get_order_number();
   
       	error_log( $order_number ); // <- Still the WooCommerce default order id from the post object, not the mapped from your plugin
       }
       ```
   
 * The problem is that we use the order number within the above hook which is at
   the initial point after the order still the old one from WooCommerce and not 
   yours. Can you please check this, confirm the issue and provide a fix?

Viewing 12 replies - 1 through 12 (of 12 total)

 *  Thread Starter [lolitsjohnnyboy](https://wordpress.org/support/users/lolitsjohnnyboy/)
 * (@lolitsjohnnyboy)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/problem-with-plugin-which-uses-specific-hook/#post-15055239)
 * Maybe you can hook into this hook as well to change the order number by using
   prio 1? I can use a lower prio, that would be no problem.
 *  Plugin Author [WebToffee](https://wordpress.org/support/users/webtoffee/)
 * (@webtoffee)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/problem-with-plugin-which-uses-specific-hook/#post-15057188)
 * Hi [@lolitsjohnnyboy](https://wordpress.org/support/users/lolitsjohnnyboy/),
 * Thanks for reaching out.
 * Could you please confirm that the issue is with a specific checkout option or
   for all checkouts? Kindly explain your checkout scenario for a better understanding.
 *  Thread Starter [lolitsjohnnyboy](https://wordpress.org/support/users/lolitsjohnnyboy/)
 * (@lolitsjohnnyboy)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/problem-with-plugin-which-uses-specific-hook/#post-15057901)
 * It’s a hook which gets executed nearly at the end of a checkout process. It appears
   at all installations.
 *  Thread Starter [lolitsjohnnyboy](https://wordpress.org/support/users/lolitsjohnnyboy/)
 * (@lolitsjohnnyboy)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/problem-with-plugin-which-uses-specific-hook/#post-15059063)
 * When a customer buys something, the order gets created and nearly at the end 
   of the checkout process, the above hook gets called. We use this hook because
   the address of the customer and other information are not set at the time of 
   the initial order creation. Somehow, your order number is missing at this point.
   Some seconds later the order number is available but not at this time at this
   hook. Maybe there is a parallel process which does something in the DB which 
   is not done at this point? I saw that you are using the order created hook for
   your plugin.
 *  Thread Starter [lolitsjohnnyboy](https://wordpress.org/support/users/lolitsjohnnyboy/)
 * (@lolitsjohnnyboy)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/problem-with-plugin-which-uses-specific-hook/#post-15068334)
 * Hello,
 * I’ve tested setting the hook execution priority to 100 without any success! For
   me, it looks like there is a process running asynchronously in the background
   which generates and sets the new order number, which takes some time.
 * To be sure, I’ve logged it at the beginning of the hook and 3 seconds later in
   an asynchronous timeout. In the asynchronous timeout, the new order number was
   returned. So somehow there is a latency which is not good for other plugins at
   all!
 * Please fix this issue somehow so that my client can use his shop again since 
   the order number is exported within this hook to several systems like printers,
   WaWi systems and a lot of other services which are connected over our plugin.
 *  Plugin Author [WebToffee](https://wordpress.org/support/users/webtoffee/)
 * (@webtoffee)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/problem-with-plugin-which-uses-specific-hook/#post-15071925)
 * Hi [@lolitsjohnnyboy](https://wordpress.org/support/users/lolitsjohnnyboy/),
 * Thanks for sharing the information and we are sorry for the inconvenience caused.
   We will look into it and will get back to you soon.
 *  Thread Starter [lolitsjohnnyboy](https://wordpress.org/support/users/lolitsjohnnyboy/)
 * (@lolitsjohnnyboy)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/problem-with-plugin-which-uses-specific-hook/#post-15075879)
 * Hi [@webtoffee](https://wordpress.org/support/users/webtoffee/),
 * do you have any news regarding this topic? We are under pressure because both
   plugins are necessary for the business to work!
 *  Plugin Author [WebToffee](https://wordpress.org/support/users/webtoffee/)
 * (@webtoffee)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/problem-with-plugin-which-uses-specific-hook/#post-15076556)
 * Hi [@lolitsjohnnyboy](https://wordpress.org/support/users/lolitsjohnnyboy/),
 * Thanks for getting back to us. We understand your situation. Kindly share your
   WooCommerce system status report via this [link](https://www.webtoffee.com/contact/)
   for a faster debugging.
 *  Thread Starter [lolitsjohnnyboy](https://wordpress.org/support/users/lolitsjohnnyboy/)
 * (@lolitsjohnnyboy)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/problem-with-plugin-which-uses-specific-hook/#post-15076574)
 * Hi@webtoffee,I see no sense sharing this with you since all you need to do is
   to copy the hook from my initial contact and just do some logging since this 
   will show you the problem – not the system report. Correct me if I’m wrong but
   that’s my point of view as a WordPress developer..
 *  Thread Starter [lolitsjohnnyboy](https://wordpress.org/support/users/lolitsjohnnyboy/)
 * (@lolitsjohnnyboy)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/problem-with-plugin-which-uses-specific-hook/#post-15079090)
 * Hello [@webtoffee](https://wordpress.org/support/users/webtoffee/),
 * we have now another user which complains about the same issues! As I told, it’s
   not possible for us to use a different hook. Is there any way you can ensure 
   that the new order number is set at the above hook?
 *  Plugin Author [WebToffee](https://wordpress.org/support/users/webtoffee/)
 * (@webtoffee)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/problem-with-plugin-which-uses-specific-hook/#post-15089875)
 * Hi [@lolitsjohnnyboy](https://wordpress.org/support/users/lolitsjohnnyboy/),
 * Thanks for waiting.
 * Since it requires some internal changes in the plugin, we will address this issue
   in our upcoming release. Thanks for understanding.
 *  Plugin Author [WebToffee](https://wordpress.org/support/users/webtoffee/)
 * (@webtoffee)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/problem-with-plugin-which-uses-specific-hook/#post-15108225)
 * Hi [@lolitsjohnnyboy](https://wordpress.org/support/users/lolitsjohnnyboy/),
 * Thanks for waiting. We have addressed the issue in the latest version of our 
   plugin. Kindly update the plugin to version 1.4.2 and check. Let us know how 
   it goes.

Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘Problem with plugin which uses specific hook’ is closed to new replies.

 * ![](https://ps.w.org/wt-woocommerce-sequential-order-numbers/assets/icon-128x128.
   png?rev=2599891)
 * [Sequential Order Number for WooCommerce](https://wordpress.org/plugins/wt-woocommerce-sequential-order-numbers/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wt-woocommerce-sequential-order-numbers/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wt-woocommerce-sequential-order-numbers/)
 * [Active Topics](https://wordpress.org/support/plugin/wt-woocommerce-sequential-order-numbers/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wt-woocommerce-sequential-order-numbers/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wt-woocommerce-sequential-order-numbers/reviews/)

 * 12 replies
 * 2 participants
 * Last reply from: [WebToffee](https://wordpress.org/support/users/webtoffee/)
 * Last activity: [4 years, 6 months ago](https://wordpress.org/support/topic/problem-with-plugin-which-uses-specific-hook/#post-15108225)
 * Status: resolved