kilowott
Forum Replies Created
-
Hi. We need to use woocommerce_payment_complete to export only paid orders. Can you suggest a way to prevent the race condition that is causing duplicate orders? Can the race condition be handled in the Vipps plugin?
Hello. Thank you for your response.
I wanted to provide you with an overview of our order flow within the system:
In our system, we maintain several states as order meta. The order progresses through the following states:
- Initial State: When an order is created in WooCommerce, it is set to the “Initial” state.
- Processing State: Once the payment is completed, the woocommerce_payment_complete hook is triggered, and the order state changes to “Processing”.
- Sending State: We then take orders in the “Processing” state and send them to our Warehouse software through an API. Just before sending, we mark the order status as “Sending.”
- Complete/Failed State: After the order is uploaded to the Warehouse software, we update the status to either “Complete” or “Failed,” depending on the API response.
Additionally, we are tracking and saving each state that the order passes through as order meta. Please see this screenshot for reference.
Here, you’ll notice that the order goes through the “Initial” state even when it’s in the “Sending” state (i.e., during the process of sending to the Warehouse software). This suggests that the payment hook triggered by Vipps is being triggered twice.
We do not have?Express Checkout?enabled on our site, so we are using the Vipps Checkout workflow. Only this is generated by vipps logs.Could you please take a look and let us know if you have any insights on this?
Thanks. We look forward to your prompt assistance.