Package.json file
{
"name": "@dtc/backend",
"version": "0.0.1",
"dependencies": {
"@medusajs/admin-sdk": "2.14.2",
"@medusajs/admin-shared": "2.14.2",
"@medusajs/caching": "2.14.2",
"@medusajs/cli": "2.14.2",
"@medusajs/dashboard": "2.14.2",
"@medusajs/draft-order": "2.14.2",
"@medusajs/file-s3": "2.14.2",
"@medusajs/framework": "2.14.2",
"@medusajs/medusa": "2.14.2",
"@medusajs/notification-local": "2.14.2",
"@medusajs/ui": "4.1.9",
"@tanstack/react-query": "5.64.2",
"zod": "4.2.0"
},
"devDependencies": {
"@medusajs/test-utils": "2.14.2",
"typescript": "^5.6.2"
},
"engines": { "node": ">=20" }
}
Node.js version
v22.23.1
Database and its version
PostgreSQL 16.14
Operating system name and version
Alpine Linux v3.24 (conteneur Docker, node:22)
Browser name
Chrome (Admin dashboard)
What happended?
The Product Variant Inventory docs state that an inventory item is created automatically when a variant is created with manage_inventory: true or updated to enable manage_inventory.
Only the create path actually works. Toggling manage_inventory from false → true on an existing variant — via the Admin dashboard, or POST /admin/products/:id/variants/:variant_id with { "manage_inventory": true } — flips the boolean but does not:
- create an inventory_item,
- create the product_variant_inventory_item link.
The variant ends up with manage_inventory = true but no linked inventory item, so it never shows up under Inventory, and there is no way in the Admin UI to associate an existing inventory item with the variant. The merchant is stuck.
This is a very common scenario: converting a made-to-order product (inventory not managed) into a stocked one after it was created.
Expected behavior
Enabling manage_inventory on an existing variant creates the inventory item and the variant↔item link, exactly as it does on variant creation (per the docs). Alternatively, the Admin dashboard exposes a way to create/associate an inventory item for an existing variant.
Actual behavior
Only product_variant.manage_inventory is updated to true. No inventory_item row is created, no product_variant_inventory_item link is created, and the Admin offers no UI to fix it. Verified in the DB:
- product_variant.manage_inventory = true
- SELECT * FROM product_variant_inventory_item WHERE variant_id = '' → 0 rows
- no matching inventory_item
Link to reproduction repo
Reproducible on a vanilla install — no custom code needed: 1. npx create-medusa-app@2.14.2 repro && cd repro 2. Admin → create a product with one variant, Manage inventory OFF. 3. Edit the variant → Manage inventory ON → Save. 4. Go to Inventory: no inventory item exists for that variant. DB confirms manage_inventory = true with no inventory_item / no product_variant_inventory_item link. Happy to push a minimal repro repo if required.
Package.json file
{ "name": "@dtc/backend", "version": "0.0.1", "dependencies": { "@medusajs/admin-sdk": "2.14.2", "@medusajs/admin-shared": "2.14.2", "@medusajs/caching": "2.14.2", "@medusajs/cli": "2.14.2", "@medusajs/dashboard": "2.14.2", "@medusajs/draft-order": "2.14.2", "@medusajs/file-s3": "2.14.2", "@medusajs/framework": "2.14.2", "@medusajs/medusa": "2.14.2", "@medusajs/notification-local": "2.14.2", "@medusajs/ui": "4.1.9", "@tanstack/react-query": "5.64.2", "zod": "4.2.0" }, "devDependencies": { "@medusajs/test-utils": "2.14.2", "typescript": "^5.6.2" }, "engines": { "node": ">=20" } }Node.js version
v22.23.1
Database and its version
PostgreSQL 16.14
Operating system name and version
Alpine Linux v3.24 (conteneur Docker, node:22)
Browser name
Chrome (Admin dashboard)
What happended?
The Product Variant Inventory docs state that an inventory item is created automatically when a variant is created with manage_inventory: true or updated to enable manage_inventory.
Only the create path actually works. Toggling manage_inventory from false → true on an existing variant — via the Admin dashboard, or POST /admin/products/:id/variants/:variant_id with { "manage_inventory": true } — flips the boolean but does not:
The variant ends up with manage_inventory = true but no linked inventory item, so it never shows up under Inventory, and there is no way in the Admin UI to associate an existing inventory item with the variant. The merchant is stuck.
This is a very common scenario: converting a made-to-order product (inventory not managed) into a stocked one after it was created.
Expected behavior
Enabling manage_inventory on an existing variant creates the inventory item and the variant↔item link, exactly as it does on variant creation (per the docs). Alternatively, the Admin dashboard exposes a way to create/associate an inventory item for an existing variant.
Actual behavior
Only product_variant.manage_inventory is updated to true. No inventory_item row is created, no product_variant_inventory_item link is created, and the Admin offers no UI to fix it. Verified in the DB:
Link to reproduction repo
Reproducible on a vanilla install — no custom code needed: 1. npx create-medusa-app@2.14.2 repro && cd repro 2. Admin → create a product with one variant, Manage inventory OFF. 3. Edit the variant → Manage inventory ON → Save. 4. Go to Inventory: no inventory item exists for that variant. DB confirms manage_inventory = true with no inventory_item / no product_variant_inventory_item link. Happy to push a minimal repro repo if required.