fix(core-flows): support 0 as a valid unit price for custom line items (#11631)
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@medusajs/core-flows": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix(core-flows): support 0 as a valid unit price for custom line items
|
||||||
@@ -756,6 +756,16 @@ medusaIntegrationTestRunner({
|
|||||||
},
|
},
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: "zero price item",
|
||||||
|
subtitle: "zero price item",
|
||||||
|
thumbnail: "some-url",
|
||||||
|
requires_shipping: false,
|
||||||
|
is_discountable: false,
|
||||||
|
is_tax_inclusive: false,
|
||||||
|
unit_price: 0,
|
||||||
|
quantity: 1,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
cart_id: cart.id,
|
cart_id: cart.id,
|
||||||
},
|
},
|
||||||
@@ -841,6 +851,12 @@ medusaIntegrationTestRunner({
|
|||||||
variant_sku: null,
|
variant_sku: null,
|
||||||
variant_title: null,
|
variant_title: null,
|
||||||
},
|
},
|
||||||
|
expect.objectContaining({
|
||||||
|
title: "zero price item",
|
||||||
|
subtitle: "zero price item",
|
||||||
|
is_custom_price: true,
|
||||||
|
unit_price: 0,
|
||||||
|
}),
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ export const addToCartWorkflow = createWorkflow(
|
|||||||
isCustomPrice: isDefined(item?.unit_price),
|
isCustomPrice: isDefined(item?.unit_price),
|
||||||
}
|
}
|
||||||
|
|
||||||
if (variant && !input.unitPrice) {
|
if (variant && !isDefined(input.unitPrice)) {
|
||||||
input.unitPrice = variant.calculated_price?.calculated_amount
|
input.unitPrice = variant.calculated_price?.calculated_amount
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user