validateShippingStep - Medusa Core Workflows Reference

This documentation provides a reference to the validateShippingStep. It belongs to the @medusajs/medusa/core-flows package.

This step validates shipping data when cart is completed.

It ensures that a shipping method is selected if there is an item in the cart that requires shipping. It also ensures that product's shipping profile mathes the selected shipping options. If the conditions are not met, an error is thrown.

NoteYou can retrieve cart or shipping option's details using Query, or useQueryGraphStep.

Example#

Code
1validateShippingStep({2  cart: {3    id: "cart_123",4    items: [5      {6        id: "item_123",7        variant: {8          id: "variant_123",9          // other item details...10        },11      }12    ],13    // other cart details...14  },15  shippingOptions: [16    {17      id: "option_123",18      shipping_profile_id: "sp_123",19      // other option details...20    }21  ]22})

Input#

ValidateShippingInputValidateShippingInput
The data to validate shipping data when cart is completed.
cartOmit<CartWorkflowDTO, "items"> & object
The cart's details.
shippingOptionsShippingOptionDTO[]
The selected shipping options.
Was this page helpful?
Ask Anything
FAQ
What is Medusa?
How can I create a module?
How can I create a data model?
How do I create a workflow?
How can I extend a data model in the Product Module?
Recipes
How do I build a marketplace with Medusa?
How do I build digital products with Medusa?
How do I build subscription-based purchases with Medusa?
What other recipes are available in the Medusa documentation?
Chat is cleared on refresh
Line break