medusajs/medusa · error · MedusaError
Variants with IDs ${priceNotFound.join(", ")} do not have a
Error message
Variants with IDs ${priceNotFound.join(", ")} do not have a price What it means
In the same pricing workflow, every variant that resolves successfully must also have a calculated price for the cart's pricing context (region/currency). Variants without any usable price are listed in this aggregate invalid_data error, since a line item cannot be created without a unit price.
Source
Thrown at packages/core/core-flows/src/cart/workflows/get-variants-and-items-with-prices.ts:172
const preparedItem = prepareLineItemData(input)
return {
selector: { id: (item_ as CartLineItemDTO).id },
data: preparedItem as Partial<UpdateLineItemDTO>,
}
})
if (variantNotFoundOrPublished.length > 0) {
throw new MedusaError(
MedusaError.Types.INVALID_DATA,
`Variants ${variantNotFoundOrPublished.join(
", "
)} do not exist or belong to a product that is not published`
)
}
if (priceNotFound.length > 0) {
throw new MedusaError(
MedusaError.Types.INVALID_DATA,
`Variants with IDs ${priceNotFound.join(", ")} do not have a price`
)
}
const result: GetVariantsAndItemsWithPricesWorkflowOutput = {
variants: variantsData,
lineItems: items,
}
return new StepResponse(result)
}
)
export const getVariantsAndItemsWithPricesId =
"get-variant-items-with-prices-workflow"
/**
* This workflow retrieves product variants and cart line items with their
* calculated prices. It's used as a sub-workflow when adding items to a cartView on GitHub (pinned to 5e06e544a2)
Solutions
- Add a money amount for the variant covering the cart's region and/or currency (Admin product pricing or Pricing module)
- Align the cart's region/currency with the currencies you have prices for
- If price lists are in play, verify the variant is included and the list is active for this customer/date range
- Re-run addToCart after fixing prices
Example fix
// before
await addToCartWorkflow(container).run({ input: { cart_id, items: [{ variant_id, quantity: 1 }] } })
// after (guard price before adding)
const { data } = await query.graph({ entity: 'variant', fields: ['id', 'calculated_price.calculated_amount'], filters: { id: variant_id }, context: { region_id: cart.region_id } })
if (data[0].calculated_price == null) throw new Error('No price for region — set variant price')
await addToCartWorkflow(container).run({ input: { cart_id, items: [{ variant_id, quantity: 1 }] } }) Defensive patterns
Strategy: validation
Validate before calling
const { data } = await query.graph({ entity: 'variant', fields: ['id', 'calculated_price.calculated_amount'], filters: { id: variantIds }, context: { region_id: cart.region_id, currency_code: cart.currency_code } })
const unpriced = variantIds.filter((id) => data.find((v) => v.id === id)?.calculated_price == null)
if (unpriced.length) throw new Error(`Variants without price for region: ${unpriced.join(', ')}`) Type guard
const isPricedVariant = (v: { calculated_price?: { calculated_amount: number | null } | null }) =>
v.calculated_price != null && v.calculated_price.calculated_amount != null Try / catch
try {
await addToCartWorkflow(container).run({ input })
} catch (e) {
if (e instanceof MedusaError && /do not have a price/.test(e.message)) {
// extract ids from message, hide 'add to cart' for those variants
}
} Prevention
- Whenever you add a region/currency, backfill prices for all sellable variants
- Catalog endpoints should expose calculated_price so the UI can disable unpriced variants
- Automate a report for variants lacking prices per active region
When it happens
Trigger: Calling addToCartWorkflow with variants that have no price records for the cart's region/currency — e.g. prices created only in another currency, price list scoped away, or variant prices never set.
Common situations: Adding prices for a subset of currencies/regions while the storefront serves others; new variants imported without prices; price lists excluding these variants; region default currency differing from the currency prices were created in.
Related errors
- invalid_data
- invalid_data
- No regions found
- Variants ${variantNotFoundOrPublished.join( ", "
- Country with code ${shippingAddress.country_code} is not wit
AI-assisted analysis of medusajs/medusa@5e06e544a2 (2026-08-27).
Data as JSON: /api/errors/c3117e555ac167f3.
Report an issue: GitHub.