Skip to content

[Bug]: Admin - Can't create promotion 'off order' #14365

@dan-long-dev

Description

@dan-long-dev

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=false --runInBand --forceExit",
    "test:unit": "TEST_TYPE=unit NODE_OPTIONS=--experimental-vm-modules jest --silent --runInBand --forceExit"
  },
  "dependencies": {
    "@medusajs/admin-sdk": "2.12.2",
    "@medusajs/cli": "2.12.2",
    "@medusajs/framework": "2.12.2",
    "@medusajs/medusa": "2.12.2"
  },
  "devDependencies": {
    "@medusajs/test-utils": "2.12.2",
    "@swc/core": "^1.7.28",
    "@swc/jest": "^0.2.36",
    "@types/jest": "^29.5.13",
    "@types/node": "^20.12.11",
    "@types/react": "^18.3.2",
    "@types/react-dom": "^18.2.25",
    "jest": "^29.7.0",
    "prop-types": "^15.8.1",
    "react": "^18.3.1",
    "react-dom": "^18.3.1",
    "ts-node": "^10.9.2",
    "typescript": "^5.6.2",
    "vite": "^5.4.14",
    "yalc": "^1.0.0-pre.53"
  },
  "engines": {
    "node": ">=20"
  }
}

Node.js version

v20.2.0

Database and its version

PostgreSQL 16.2

Operating system name and version

MacOS Tahoe - 26.1

Browser name

Chrome

What happended?

When trying to create the following two promotion types:

  • Amount off order
  • Percentage off order

The max_quantity field is hidden (as expected) on the details tab, however, its value (1) is being sent in the API request and causing the error "application_method.max_quantity is not allowed to be set for allocation (across)"

{
    "code": "FREE",
    "type": "standard",
    "status": "draft",
    "limit": 999,
    "rules": [
        {
            "operator": "eq",
            "attribute": "sales_channel_id",
            "values": "XXX"
        }
    ],
    "application_method": {
        "allocation": "across",
        "value": 100,
        "max_quantity": 1, <-- ERROR HERE
        "type": "percentage",
        "target_type": "order",
        "target_rules": [],
        "buy_rules": []
    },
    "is_tax_inclusive": false,
    "is_automatic": false
}

Expected behavior

Go through the promotion wizard and successfully create 'off order' promotions.

Actual behavior

When clicking save in the promotion wizard when trying to create an 'off order' an error occurs "application_method.max_quantity is not allowed to be set for allocation (across)".

Link to reproduction repo

It's an admin issue - currently using Medusa Cloud hosting - https://github.com/medusajs/medusa

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions