fix: Add shipping options for cart fix (#7205)

This commit is contained in:
Stevche Radevski authored and GitHub committed 2024-05-02 10:33:58 +00:00
1 parent f430ed7040
commit 6487931f54
2 files changed
+210 -2

No files matched your search

@@ -23,9 +23,10 @@ export const GET = async (req: MedusaRequest, res: MedusaResponse) => {
relations: ["shipping_address"],
})
const shippingOptions = await listShippingOptionsForCartWorkflow(
const { result, errors } = await listShippingOptionsForCartWorkflow(
req.scope
).run({
throwOnError: false,
input: {
cart_id: cart.id,
sales_channel_id: cart.sales_channel_id,
@@ -38,5 +39,9 @@ export const GET = async (req: MedusaRequest, res: MedusaResponse) => {
},
})
res.json({ shipping_options: shippingOptions })
if (Array.isArray(errors) && errors[0]) {
throw errors[0].error
}
res.json({ shipping_options: result })
}