Using Shopware 6 store-api, I want a list of orders with associated documents. I submit a POST the store-api/order endpoint with this body:
{
"includes": {
"order": [
"orderNumber",
"documents"
]
},
"associations": {
"documents": []
}
}
However, the response just shows empty arrays for the documents.
{
"apiAlias": "order-route-response-struct",
"orders": {
"elements": [
{
"orderNumber": "SW1001",
"documents": [],
"apiAlias": "order"
},
{
"orderNumber": "SW1002",
"documents": [],
"apiAlias": "order"
}
],
"aggregations": [],
"page": 1,
"limit": 100,
"entity": "order",
"total": 2,
"states": [],
"apiAlias": "dal_entity_search_result"
},
"paymentChangeable": []
}
In Shopware Admin I can verify that both orders do have associated invoices.
How can I enforce the response to contain the information for the associated orders?
For a document to be included in the response to the
store-api/orderendpoint,Note that the latter (2.) has to take place before (!) a document is created, the setting will have no effect for existing documents.