- Get Started
- Product
- Resources
- Tools & SDKs
- Framework
- Reference
Menu
- Get Started
- Product
- Resources
- Tools & SDKs
- Framework
- Reference
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.
Example#
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#
ValidateShippingInput
ValidateShippingInputThe data to validate shipping data when cart is completed.
ValidateShippingInput
ValidateShippingInputcart
Omit<CartWorkflowDTO, "items"> & objectThe cart's details.
cart
Omit<CartWorkflowDTO, "items"> & objectshippingOptions
ShippingOptionDTO[]The selected shipping options.
shippingOptions
ShippingOptionDTO[]Was this page helpful?