• Resolved cstrango

    (@cstrango)


    Hi, I’m not sure if this topic has been created before.

    I am using the WooCommerce webhooks and sending them to Power Automate flows, more specifically when creating or updating an order.

    I have created the same flow for both webhooks, because they have similar flows and it is easier for me to manage them.

    When I update an order everything works fine, but when I’m creating one both create/update webhooks get sent to my flow, at the same time, first the creating and then updating one.

    Is that a problem? Or is it just how it works?

    Thanks in advance

Viewing 2 replies - 1 through 2 (of 2 total)
  • Saif

    (@babylon1999)

    Hello @cstrango,

    Thank you for reaching out!

    I’m able to reproduce this. In theory, when an order is created, it’s instantly updated with data from the payment gateway, inventory changes, etc. so I’m not sure if this can be considered a bug.

    I’ll discuss this with the rest of the team to confirm if it’s something we need to address. I’ll make sure to update the thread accordingly. :?)

    In the meantime, let us know if you have any other questions.

    Saif

    (@babylon1999)

    Just following up as promised, @cstrango! :?)

    I’ve gone ahead and submitted an issue report regarding this behaviour. I suggest subscribing to it via the sidebar to stay updated: https://github.com/woocommerce/woocommerce/issues/43019

    If you intend to trigger the webhook based on a specific action, you can create a custom topic for it as explained here: https://gist.github.com/jessepearson/66a0e72706b99c15b52dee7ce59e1d31

    The snippet is mostly ready-to-use, you only need to change the logic of the last function ‘my_order_item_check.’

    For instance, let’s alter the logic for when the order status is changed to failed:

    function my_custom_webhook_order_updated( $order_id, $posted_data, $order ) {
    	
    	$order = wc_get_order( $order_id );
         do_action( 'custom_order_filter', $order_id, $posted_data, $order );
    	return;
    }
    add_action( 'woocommerce_order_status_failed', 'my_custom_webhook_order_updated', 10, 3 );

    If you need to customize this further, I suggest exploring the?#developers?channel of the?Woo Community Slack?or consulting with a?WooExpert as custom solutions is not something we generally provide support for per our support policy.

    Hope this helps!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Webhook order.created/updated’ is closed to new replies.