fix(medusa): Legacy total service to accept custom items (#3027)

This commit is contained in:
Adrien de Peretti
2023-01-16 09:57:01 +01:00
committed by GitHub
parent 27a29ef24e
commit 8c08d00319
2 changed files with 7 additions and 2 deletions

View File

@@ -0,0 +1,5 @@
---
"@medusajs/medusa": patch
---
fix(medusa): Legacy total service should accept custom items

View File

@@ -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"