diff --git a/.changeset/early-cherries-care.md b/.changeset/early-cherries-care.md new file mode 100644 index 0000000000000..780e3659f6139 --- /dev/null +++ b/.changeset/early-cherries-care.md @@ -0,0 +1,5 @@ +--- +"@medusajs/medusa": patch +--- + +fix(medusa): Legacy total service should accept custom items diff --git a/packages/medusa/src/services/totals.ts b/packages/medusa/src/services/totals.ts index 79ba4766f35e0..893c3dd508d25 100644 --- a/packages/medusa/src/services/totals.ts +++ b/packages/medusa/src/services/totals.ts @@ -840,7 +840,7 @@ class TotalsService extends TransactionBaseService { * items we have to get the line items from the tax provider. */ if (options.use_tax_lines || isOrder(cartOrOrder)) { - if (typeof lineItem.tax_lines === "undefined") { + if (!isDefined(lineItem.tax_lines) && lineItem.variant_id) { throw new MedusaError( MedusaError.Types.UNEXPECTED_STATE, "Tax Lines must be joined on items to calculate taxes" @@ -850,7 +850,7 @@ class TotalsService extends TransactionBaseService { taxLines = lineItem.tax_lines } else { if (lineItem.is_return) { - if (typeof lineItem.tax_lines === "undefined") { + if (!isDefined(lineItem.tax_lines) && lineItem.variant_id) { throw new MedusaError( MedusaError.Types.UNEXPECTED_STATE, "Return Line Items must join tax lines"