Skip to content

[Bug]: Include discounts in line_items for tax getTaxLines #13666

@danlapteacru

Description

@danlapteacru

Package.json file

{
  "name": "medusa-starter-default",
  "version": "0.0.1",
  "description": "A starter for Medusa projects.",
  "author": "Medusa (https://medusajs.com)",
  "license": "MIT",
  "keywords": [
    "sqlite",
    "postgres",
    "typescript",
    "ecommerce",
    "headless",
    "medusa"
  ],
  "scripts": {
    "build": "medusa build",
    "seed": "medusa exec ./src/scripts/seed.ts",
    "start": "medusa start",
    "dev": "medusa develop",
    "test:integration:http": "TEST_TYPE=integration:http NODE_OPTIONS=--experimental-vm-modules jest --silent=false --runInBand --forceExit",
    "test:integration:modules": "TEST_TYPE=integration:modules NODE_OPTIONS=--experimental-vm-modules jest --silent --runInBand --forceExit",
    "test:unit": "TEST_TYPE=unit NODE_OPTIONS=--experimental-vm-modules jest --silent --runInBand --forceExit",
    "migrate": "npx medusa db:migrate",
    "generate": "npx medusa db:generate"
  },
  "dependencies": {
    "@hello-pangea/dnd": "^16.6.0",
    "@medusajs/admin-sdk": "^2.8.7",
    "@medusajs/cli": "^2.8.7",
    "@medusajs/file-s3": "^2.8.7",
    "@medusajs/framework": "^2.8.7",
    "@medusajs/icons": "^2.8.7",
    "@medusajs/js-sdk": "^2.8.7",
    "@medusajs/medusa": "^2.8.7",
    "@medusajs/types": "^2.8.7",
    "@mikro-orm/core": "^6.4.5",
    "@mikro-orm/knex": "^6.4.5",
    "@mikro-orm/migrations": "^6.4.5",
    "@mikro-orm/postgresql": "^6.4.5",
    "@opentelemetry/instrumentation": "^0.57.1",
    "@opentelemetry/instrumentation-pg": "^0.51.0",
    "@opentelemetry/resources": "^1.30.1",
    "@opentelemetry/sdk-node": "^0.57.1",
    "@opentelemetry/sdk-trace-node": "^1.30.1",
    "@radix-ui/react-scroll-area": "^1.2.3",
    "@radix-ui/react-separator": "^1.1.2",
    "@sentry/node": "^9.0.0",
    "@sentry/opentelemetry-node": "^7.114.0",
    "@sentry/profiling-node": "^9.0.0",
    "@tanstack/react-table": "^8.17.3",
    "@types/multer": "^1.4.12",
    "@uppy/box": "^3.1.2",
    "@uppy/core": "^4.3.0",
    "@uppy/dashboard": "^4.1.3",
    "@uppy/drag-drop": "^4.0.5",
    "@uppy/dropbox": "^4.1.2",
    "@uppy/file-input": "^4.0.4",
    "@uppy/google-drive": "^4.2.0",
    "@uppy/onedrive": "^4.1.2",
    "@uppy/progress-bar": "^4.0.2",
    "@uppy/react": "^4.0.4",
    "@uppy/transloadit": "^4.1.4",
    "@uppy/tus": "^4.1.5",
    "ai": "^4.1.39",
    "awilix": "^8.0.1",
    "axios": "^1.7.2",
    "body-parser": "^1.19.0",
    "class-variance-authority": "^0.7.1",
    "clsx": "^2.1.1",
    "cors": "^2.8.5",
    "csv-parser": "^3.2.0",
    "d3": "^7.9.0",
    "dotenv": "16.3.1",
    "express": "^4.17.2",
    "highlight.js": "^11.9.0",
    "ioredis": "^5.4.1",
    "jose": "^5.9.6",
    "jsonwebtoken": "^9.0.2",
    "jwt-decode": "^4.0.0",
    "katex": "^0.16.21",
    "lodash.debounce": "^4.0.8",
    "lowlight": "^3.3.0",
    "lucide-react": "^0.475.0",
    "moment": "^2.30.1",
    "novel": "^1.0.2",
    "pg": "^8.13.0",
    "posthog-node": "^5.1.0",
    "prism-react-renderer": "^2.0.4",
    "quill": "^2.0.2",
    "react-color": "^2.19.3",
    "react-dropzone": "^14.3.5",
    "react-hook-form": "^7.52.0",
    "react-hot-toast": "^2.4.1",
    "react-quilljs": "^2.0.3",
    "react-select": "^5.8.1",
    "react-select-async-paginate": "^0.7.9",
    "tailwind-merge": "^3.0.1",
    "tailwindcss": "^4.1.11",
    "tailwindcss-animate": "^1.0.7",
    "tus-js-client": "^4.1.0",
    "use-debounce": "^10.0.4"
  },
  "devDependencies": {
    "@babel/cli": "^7.14.3",
    "@babel/core": "^7.14.3",
    "@babel/preset-typescript": "^7.21.4",
    "@medusajs/test-utils": "^2.8.7",
    "@mikro-orm/cli": "^6.4.5",
    "@stdlib/number-float64-base-normalize": "0.0.8",
    "@swc/core": "1.5.7",
    "@swc/jest": "^0.2.36",
    "@types/express": "^4.17.13",
    "@types/jest": "^29.5.13",
    "@types/jsonwebtoken": "^9.0.9",
    "@types/mime": "1.3.5",
    "@types/node": "^20.0.0",
    "@types/quill": "^2.0.14",
    "@types/react": "^18.3.2",
    "@types/react-dom": "^18.2.25",
    "cross-env": "^7.0.3",
    "eslint": "^6.8.0",
    "jest": "^29.7.0",
    "prop-types": "^15.8.1",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "rimraf": "^3.0.2",
    "ts-jest": "^27.0.7",
    "ts-loader": "^9.2.6",
    "ts-node": "^10.9.2",
    "typescript": "^5.6.2",
    "vite": "^5.2.11"
  },
  "jest": {
    "globals": {
      "ts-jest": {
        "tsconfig": "tsconfig.spec.json"
      }
    },
    "moduleFileExtensions": [
      "js",
      "json",
      "ts"
    ],
    "testPathIgnorePatterns": [
      "/node_modules/",
      "<rootDir>/node_modules/"
    ],
    "rootDir": "src",
    "testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|js)$",
    "transform": {
      ".ts": "ts-jest"
    },
    "collectCoverageFrom": [
      "**/*.(t|j)s"
    ],
    "coverageDirectory": "./coverage",
    "testEnvironment": "node"
  },
  "resolutions": {
    "glob": "^7.1.6",
  },
  "engines": {
    "node": ">=20"
  }
}

Node.js version

v22

Database and its version

PostgreSQL 17

Operating system name and version

MacOs 15.6.1 (24G90)

Browser name

No response

What happended?

Actually, I’m not sure if this is a bug or not, but we are using a custom Tax Provider for Zamp. The issue is that we want to exclude tax calculations for products with a total of $0 after promotions are applied (for example, a “buy X, get Y” promotion).

Expected behavior

It would be helpful if the discount_total field were available in [TaxableItemDTO](https://docs.medusajs.com/resources/references/tax/interfaces/tax.TaxableItemDTO).

Actual behavior

In [TaxableItemDTO](https://docs.medusajs.com/resources/references/tax/interfaces/tax.TaxableItemDTO), only the unit_price and quantity fields exist, but discount is not available.

Link to reproduction repo

https://github.com/medusajs/medusa/

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions