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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user