validateAndReturnShippingMethodsDataStep - Medusa Core Workflows Reference

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

This step validates shipping options to ensure they can be applied on a cart. The step either returns the validated data or void.

Example#

Code
1const data = validateAndReturnShippingMethodsDataStep({2  id: "sm_123",3  provider_id: "my_provider",4  option_data: {},5  method_data: {},6  context: {7    id: "cart_123",8    shipping_address: {9      id: "saddr_123",10      first_name: "Jane",11      last_name: "Smith",12      address_1: "456 Elm St",13      city: "Shelbyville",14      country_code: "us",15      postal_code: "67890",16    },17    items: [18      {19        variant: {20          id: "variant_123",21          weight: 1,22          length: 1,23          height: 1,24          width: 1,25          material: "wood",26          product: {27            id: "prod_123"28          }29        }30      }31    ],32    product: {33      id: "prod_123",34      collection_id: "pcol_123",35      categories: [],36      tags: []37    },38    from_location: {39      id: "sloc_123",40      first_name: "John",41      last_name: "Doe",42      address_1: "123 Main St",43      city: "Springfield",44      country_code: "us",45      postal_code: "12345",46    },47  }48})

Input#

ValidateShippingMethodsDataInputValidateShippingMethodsDataInput
The details of the shipping methods to validate.
idstring
The shipping method's ID.
provider_idstring
The fulfillment provider ID that associated with the shipping option that the method was created from.
option_dataRecord<string, unknown>
The data property of the shipping option that the shipping method was created from.
method_dataRecord<string, unknown>
The data property of the shipping method.
The context to validate the shipping method.

Output#

object[]object[]
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