medusajs/medusa · error · MedusaError
invalid_data
invalid_data
Error message
Shipping option with ID ${shippingOption.id} do not have a price What it means
addShippingMethodToCartWorkflow validates that every shipping option in the input has a calculated price for the cart's context (region/currency). Without a calculated_price the shipping method cannot be priced, so the step aborts with invalid_data.
Source
Thrown at packages/core/core-flows/src/cart/workflows/add-shipping-method-to-cart.ts:169
const validatedMethodData = validateAndReturnShippingMethodsDataStep(
validateShippingMethodsDataInput
)
const shippingMethodInput = transform(
{
input,
shippingOptions,
validatedMethodData,
},
(data) => {
const options = (data.input.options ?? []).map((option) => {
const shippingOption = data.shippingOptions.find(
(so) => so.id === option.id
)!
if (!shippingOption?.calculated_price) {
throw new MedusaError(
MedusaError.Types.INVALID_DATA,
`Shipping option with ID ${shippingOption.id} do not have a price`
)
}
const methodData = data.validatedMethodData?.find((methodData) => {
return methodData?.[option.id]
})
return {
shipping_option_id: shippingOption.id,
amount: shippingOption.calculated_price.calculated_amount,
is_tax_inclusive:
!!shippingOption.calculated_price
.is_calculated_price_tax_inclusive,
data: methodData?.[option.id] ?? {},
name: shippingOption.name,
cart_id: data.input.cart_id,View on GitHub (pinned to 5e06e544a2)
Solutions
- Verify the shipping option has a price for the cart's region and currency (Admin: Shipping > option > prices, or query pricing)
- Add the missing region/currency price for the option and retry
- If using a calculated option, check the fulfillment provider's price calculation returns a value for this cart
- Confirm the cart's region_id is the one you intended before adding the method
Example fix
// before
await addShippingMethodToCartWorkflow(container).run({ input: { cart_id, option_id: soId } })
// after (verify price first)
const { data: [so] } = await query.graph({ entity: 'shipping_option', fields: ['*', 'prices.*'], filters: { id: soId } })
if (!so.prices.some((p) => p.currency_code === cart.currency_code)) {
throw new Error('Option not priced for cart currency — add price in admin')
}
await addShippingMethodToCartWorkflow(container).run({ input: { cart_id, option_id: soId } }) Defensive patterns
Strategy: validation
Validate before calling
const { data: [so] } = await query.graph({ entity: 'shipping_option', fields: ['id', 'prices.currency_code', 'prices.region_id'], filters: { id: option_id } })
const priced = so.prices.some((p) => p.region_id === cart.region_id || p.currency_code === cart.currency_code)
if (!priced) throw new Error('Shipping option not priced for this cart context') Type guard
const isPricedForCart = (so: ShippingOptionDTO, cart: CartDTO) => so.prices?.some((p) => p.region_id === cart.region_id || p.currency_code === cart.currency_code) ?? false
Try / catch
try {
await addShippingMethodToCartWorkflow(container).run({ input })
} catch (e) {
if (e instanceof MedusaError && /do not have a price/.test(e.message)) {
// exclude option from shipping list, notify merchant to add region price
}
} Prevention
- Keep every shipping option priced for every region it is offered in
- Filter the shipping options list shown to customers by region/currency coverage
When it happens
Trigger: Calling addShippingMethodToCart with an option id whose prices were deleted, are scoped to another region/currency, or whose price calculation (e.g. flat rate rules or provider calculation) returned nothing for this cart.
Common situations: Shipping option prices created only for one region while the cart belongs to another; price records removed or expired; currency mismatch between cart and price; misconfigured price rules for calculated (provider-based) shipping options.
Related errors
- Variants with IDs ${priceNotFound.join(", ")} do not have a
- No regions found
- Country with code ${shippingAddress.country_code} is not wit
- Line item ${item.title} has no unit price
- Missing required pricing context to calculate prices - regio
AI-assisted analysis of medusajs/medusa@5e06e544a2 (2026-08-27).
Data as JSON: /api/errors/86d2dbc40cca3373.
Report an issue: GitHub.