We have a flow set up in the Flow builder, which should trigger on Checkout
> Order
> Placed
. However, when we place an order via the Admin API (POST
-request to /api/order
) the flow doesn't get triggered.
I've tried different order triggers (such as State enter
> Order
> State
> Open
), but this also doesn't trigger the flow. I've tested this on versions 6.5.4.1 and 6.4.20.0.
Is this intended behavior? Am I maybe not using the correct triggers, or could I be missing a setting in Shopware?
When you create orders via the generic CRUD endpoints of the Admin-API, then you're circumventing all the customer-facing business logic of the Store-API. When you add products to the cart and go through the checkout in the storefront, the carts data will be processed, calculated and invalidated. This includes flows being triggered. You simply won't get that if you directly persist an order.
When you create orders via the administration UI, it will use special proxy endpoints of the Admin-API, that will use the Store-API logic for manual creation of orders. You're essentially creating a cart for a specific customer and going through the checkout for them, triggering all the relevant flows etc along the way. You should be able to retrace the necessary steps by inspecting the outgoing requests when creating an order manually in the administration UI.
Alternatively you could try creating the order initially with a state that other than open
, e.g. create them with the cancelled
or in_progress
state. Then you could use the proper endpoints to transition from one state to another. This should then trigger the flows accordingly.