fix(core-flows): Access orderItem.variant safely inside convertDraftOrderWorkflow when containing custom items (#14233)

* Access orderItem variant safely on convert draft order workflow

* Tests

* Add changest

* Remove .only from test
This commit is contained in:
Nicolas Gorga
2025-12-08 08:56:05 -03:00
committed by GitHub
parent b53d63d6c8
commit fea3d4ec49
3 changed files with 105 additions and 2 deletions

View File

@@ -143,11 +143,13 @@ export const convertDraftOrderWorkflow = createWorkflow(
for (const orderItem of orderItems.items ?? []) {
items.push({
variant_id: orderItem.variant.id,
variant_id: orderItem.variant?.id,
quantity: orderItem.quantity,
id: orderItem.id,
})
variants.push(orderItem.variant)
if (orderItem.variant) {
variants.push(orderItem.variant)
}
}
return {