calculateShippingOptionsPricesStep - Medusa Core Workflows Reference

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

This step calculates the prices for one or more shipping options.

Example#

Code
1const data = calculateShippingOptionsPricesStep([{2  id: "so_123",3  provider_id: "provider_123",4  optionData: {5    // custom data relevant for the fulfillment provider6    carrier_code: "UPS",7  },8  data: {9    // custom data relevant for the fulfillment provider10    // specific to the cart using this shipping option11  },12  context: {13    from_location: {14      id: "sloc_123",15      // other location fields16    }17  }18}])

Input#

CalculateShippingOptionsPriceStepInputCalculateShippingOptionsPriceStepInput
The data to calculate the prices for one or more shipping options.
idstring
The ID of the shipping option.
provider_idstring
The ID of the fulfillment provider.
optionDataRecord<string, unknown>
The data property of the shipping option.
dataRecord<string, unknown>
The shipping method's data property with custom data passed from the frontend.
contextCartPropsForFulfillment & { [k: string]: unknown; from_location?: StockLocationDTO | undefined; } & CalculatedRMAShippingContext
The calculation context needed for the associated fulfillment provider to calculate the price of a shipping option.

Output#

CalculatedShippingOptionPrice[]CalculatedShippingOptionPrice[]
calculated_amountnumber
The calculated price.
is_calculated_price_tax_inclusiveboolean
Whether the calculated price includes taxes. If enabled, Medusa will infer the taxes from the calculated price. If false, Medusa will add taxes to the calculated price.
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