• Resolved lolitsjohnnyboy

    (@lolitsjohnnyboy)


    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

    (@lolitsjohnnyboy)

    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

    (@webtoffee)

    Hi @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

    (@lolitsjohnnyboy)

    It’s a hook which gets executed nearly at the end of a checkout process. It appears at all installations.

    Thread Starter lolitsjohnnyboy

    (@lolitsjohnnyboy)

    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

    (@lolitsjohnnyboy)

    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

    (@webtoffee)

    Hi @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

    (@lolitsjohnnyboy)

    Hi @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

    (@webtoffee)

    Hi @lolitsjohnnyboy,

    Thanks for getting back to us. We understand your situation. Kindly share your WooCommerce system status report via this link for a faster debugging.

    Thread Starter lolitsjohnnyboy

    (@lolitsjohnnyboy)

    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

    (@lolitsjohnnyboy)

    Hello @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

    (@webtoffee)

    Hi @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

    (@webtoffee)

    Hi @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.