{"record":{"id":"c3117e555ac167f3","repo":"medusajs/medusa","slug":"variants-with-ids-pricenotfound-join-do-n","errorCode":null,"errorMessage":"Variants with IDs ${priceNotFound.join(\", \")} do not have a price","messagePattern":"Variants with IDs (.+?) do not have a price","errorType":"exception","errorClass":"MedusaError","httpStatus":400,"severity":"error","filePath":"packages/core/core-flows/src/cart/workflows/get-variants-and-items-with-prices.ts","lineNumber":172,"sourceCode":"\n      const preparedItem = prepareLineItemData(input)\n\n      return {\n        selector: { id: (item_ as CartLineItemDTO).id },\n        data: preparedItem as Partial<UpdateLineItemDTO>,\n      }\n    })\n\n    if (variantNotFoundOrPublished.length > 0) {\n      throw new MedusaError(\n        MedusaError.Types.INVALID_DATA,\n        `Variants ${variantNotFoundOrPublished.join(\n          \", \"\n        )} do not exist or belong to a product that is not published`\n      )\n    }\n    if (priceNotFound.length > 0) {\n      throw new MedusaError(\n        MedusaError.Types.INVALID_DATA,\n        `Variants with IDs ${priceNotFound.join(\", \")} do not have a price`\n      )\n    }\n\n    const result: GetVariantsAndItemsWithPricesWorkflowOutput = {\n      variants: variantsData,\n      lineItems: items,\n    }\n    return new StepResponse(result)\n  }\n)\n\nexport const getVariantsAndItemsWithPricesId =\n  \"get-variant-items-with-prices-workflow\"\n/**\n * This workflow retrieves product variants and cart line items with their\n * calculated prices. It's used as a sub-workflow when adding items to a cart","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/medusajs/medusa/blob/5e06e544a296b9033f20f71f11c559f81a0e5739/packages/core/core-flows/src/cart/workflows/get-variants-and-items-with-prices.ts#L154-L190","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nawait addToCartWorkflow(container).run({ input: { cart_id, items: [{ variant_id, quantity: 1 }] } })\n\n// after (guard price before adding)\nconst { data } = await query.graph({ entity: 'variant', fields: ['id', 'calculated_price.calculated_amount'], filters: { id: variant_id }, context: { region_id: cart.region_id } })\nif (data[0].calculated_price == null) throw new Error('No price for region — set variant price')\nawait addToCartWorkflow(container).run({ input: { cart_id, items: [{ variant_id, quantity: 1 }] } })","handlingStrategy":"validation","validationCode":"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 } })\nconst unpriced = variantIds.filter((id) => data.find((v) => v.id === id)?.calculated_price == null)\nif (unpriced.length) throw new Error(`Variants without price for region: ${unpriced.join(', ')}`)","typeGuard":"const isPricedVariant = (v: { calculated_price?: { calculated_amount: number | null } | null }) =>\n  v.calculated_price != null && v.calculated_price.calculated_amount != null","tryCatchPattern":"try {\n  await addToCartWorkflow(container).run({ input })\n} catch (e) {\n  if (e instanceof MedusaError && /do not have a price/.test(e.message)) {\n    // extract ids from message, hide 'add to cart' for those variants\n  }\n}","preventionTips":["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"],"tags":["cart","pricing","variant","region","currency"],"backgroundTag":"missing-price-for-context","analyzedSha":"5e06e544a296b9033f20f71f11c559f81a0e5739","analyzedAt":"2026-08-27T07:24:39.599Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}