Skip to content

[Bug]: DELETE promotion from cart returns STALE payment collection/session #13936

@fogine

Description

@fogine

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": {
    "test": "npx medusa exec ./src/scripts/test.ts",
    "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"
  },
  "dependencies": {
    "@medusajs/admin-sdk": "2.11.2",
    "@medusajs/cli": "2.11.2",
    "@medusajs/framework": "2.11.2",
    "@medusajs/medusa": "2.11.2",
    "@mikro-orm/core": "6.4.16",
    "@mikro-orm/knex": "6.4.16",
    "@mikro-orm/migrations": "6.4.16",
    "@mikro-orm/postgresql": "6.4.16",
    "awilix": "^8.0.1",
    "axios": "^1.7.9",
    "pg": "^8.13.0",
    "rambda": "^9.4.1"
  },
  "devDependencies": {
    "@medusajs/test-utils": "2.1.3",
    "@mikro-orm/cli": "6.4.16",
    "@swc/core": "1.5.7",
    "@swc/jest": "^0.2.36",
    "@types/jest": "^29.5.13",
    "@types/node": "^20.0.0",
    "@types/react": "^18.3.2",
    "@types/react-dom": "^18.2.25",
    "jest": "^29.7.0",
    "prop-types": "^15.8.1",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "ts-node": "^10.9.2",
    "typescript": "^5.6.2",
    "vite": "^5.2.11"
  },
  "engines": {
    "node": ">=20"
  }
}

Node.js version

v20.19.3

Database and its version

PostgreSQL 16.8

Operating system name and version

Linux

Browser name

No response

What happended?

When you apply promotion code to a cart using update cart store API, it correctly responds with updated card with correct payment collection and payment session price amounts.

However when you delete the previously applied promotion from the cart using DELETE store cart promotion API it returns cart without the promotion (promotions is empty array) BUT
with STALE payment collection and payment session - payment amount values are as if the promotion was still applied.

Expected behavior

after calling DELETE store cart promotion API it should return cart with updated cart collection and cart session price amounts.

Actual behavior

DELETE store cart promotion API returns cart
with STALE payment collection and payment session - payment amount values are as if the promotion was still applied.

Link to reproduction repo

none

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