createShippingOptionsWorkflow - Medusa Core Workflows Reference

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

This workflow creates one or more shipping options. It's used by the Create Shipping Option Admin API Route.

You can use this workflow within your own customizations or custom workflows, allowing you to create shipping options within your custom flows.

Source Code

Examples#

To calculate a shipping option with flat rate prices:

To calculate shipping option with calculated prices, set

to

and don't pass a

array:

NoteYou can calculate the shipping option's price for a cart using the calculateShippingOptionsPricesWorkflow.

Steps#

Input#

CreateShippingOptionsWorkflowInputCreateShippingOptionsWorkflowInput
The data to create the shipping options.
CreateShippingOptionsWorkflowInputCreateShippingOptionsWorkflowInput[]
The data to create the shipping options.

Output#

CreateShippingOptionsWorkflowOutputCreateShippingOptionsWorkflowOutput
idstring
The ID of the shipping option.
namestring
The name of the shipping option.
The type of the shipping option's price.
service_zone_idstring
The associated service zone's ID.
shipping_profile_idstring
The associated shipping profile's ID.
provider_idstring
The associated fulfillment provider's ID.
shipping_option_type_idnull | string
The associated shipping option type's ID.
datanull | Record<string, unknown>
The data necessary for the associated fulfillment provider to process the shipping option and, later, its associated fulfillments.
metadatanull | Record<string, unknown>
Holds custom data in key-value pairs.
service_zoneServiceZoneDTO
The associated service zone.
shipping_profileShippingProfileDTO
The associated shipping profile.
fulfillment_providerFulfillmentProviderDTO
The associated fulfillment provider.
The associated shipping option type.
The rules associated with the shipping option.
fulfillmentsFulfillmentDTO[]
The fulfillments associated with the shipping option.
created_atDate
The creation date of the shipping option.
updated_atDate
The update date of the shipping option.
deleted_atnull | Date
The deletion date of the shipping option.
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