medusajs / medusa

The world's most flexible commerce platform.
https://medusajs.com
MIT License
25.95k stars 2.61k forks source link

[Bug]: Promotion is not working with sales channel conditions #10089

Open cuong88pham opened 3 days ago

cuong88pham commented 3 days ago

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"
  },
  "dependencies": {
    "@lexical/file": "^0.19.0",
    "@lexical/react": "^0.19.0",
    "@medusajs/admin-sdk": "latest",
    "@medusajs/cli": "latest",
    "@medusajs/framework": "latest",
    "@medusajs/medusa": "latest",
    "@mikro-orm/core": "5.9.7",
    "@mikro-orm/knex": "5.9.7",
    "@mikro-orm/migrations": "5.9.7",
    "@mikro-orm/postgresql": "5.9.7",
    "awilix": "^8.0.1",
    "axios": "^1.7.7",
    "katex": "^0.16.11",
    "lexical": "^0.19.0",
    "lodash": "^4.17.21",
    "lodash-es": "^4.17.21",
    "lucide-react": "^0.454.0",
    "moment": "^2.30.1",
    "pg": "^8.13.0",
    "prettier": "^3.3.3",
    "react-dropzone": "^14.2.10"
  },
  "devDependencies": {
    "@medusajs/test-utils": "latest",
    "@mikro-orm/cli": "5.9.7",
    "@swc/core": "1.5.7",
    "@swc/jest": "^0.2.36",
    "@types/jest": "^29.5.13",
    "@types/lodash": "^4.17.12",
    "@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

v21

Database and its version

PostgreSQL 16

Operating system name and version

MacOS

Browser name

No response

What happended?

When we create promotion for special sales channel we can not apply at frontstore

Expected behavior

Can create promotion code and apply code for special Sales Channel

Actual behavior

Only create promotion code for special Sales channel, but can not apply at frontstore

Link to reproduction repo

https://github.com/cuong88pham/medusa

sradevski commented 2 days ago

Hi there, the reproduction repo is just a fork of Medusa, not very helpful.

Please provide more information on what you are doing, what isn't working, what you'd expect to happen and so on. Include screenshots or video if that makes it easier. With this information we can't do much.

cuong88pham commented 2 days ago

Hi @sradevski i worked on private repo so can not share link, btw in case i create new promotion call CODE1 without any condition it is worked, can add to cart and get discount amount, but when i add condition for special sales channel it is not worked. after playaround i see maybe we miss sales_channel_id at cartFieldsForRefreshSteps