You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If your product variant has the settings: Managed Inventory = true and Allowed backorders = true, but no Stock Locations are added for Inventory Item of this variant and when you try to add it to cart you will get error 400: stack: 'Error: Sales channel sc_01JCHCH6E5ZF7760H5J5WFC4T3SZY is not associated with any stock location.\n'+'
It's how to reproduce the problem:
for any product variant, set the settings: Managed Inventory = true and Allowed backorders = true
Create an Inventory Item and link it to your product variant.
Go to our Inventory Item, and make sure no locations are added.
Try to add our variant to cart - you'll receive server error 400: "Sales channel xxx is not associated with any stock location" when add variant with backorder to cart."
Expected behavior
It is expected that the variant will be added to the cart since the "Allowed backorders = true" option is enabled
Actual behavior
You're getting server error 400. Here is the full server error code.
(Actually the error sounds strange, because this sales channel has a connection to several Locations. It's just that these locations are not added specifically to our test case.)
error: Sales channel sc_01JCH6E5ZF7760H5JWFC4T3SZY is not associated with any stock location.
{
message: 'Sales channel sc_01JCH6E5ZF7760H5JWFC4T3SZY is not associated with any stock location.',
name: 'Error',
stack: 'Error: Sales channel sc_01JCH6E5ZF7760H5JWFC4T3SZY is not associated with any stock location.\n' +
' at Function.prepareConfirmInventoryInput (/root/backend-server/node_modules/@medusajs/core-flows/src/cart/utils/prepare-confirm-inventory-input.ts:104:11)\n' +
' at Proxy.returnFn (/root/backend-server/node_modules/@medusajs/workflows-sdk/src/utils/composer/transform.ts:192:30)\n' +
' at processTicksAndRejections (node:internal/process/task_queues:105:5)\n' +
' at async resolveProperty (/root/backend-server/node_modules/@medusajs/workflows-sdk/src/utils/composer/helpers/resolve-value.ts:17:11)\n' +
' at async resolveValue (/root/backend-server/node_modules/@medusajs/workflows-sdk/src/utils/composer/helpers/resolve-value.ts:78:7)\n' +
' at async Object.invoke (/root/backend-server/node_modules/@medusajs/workflows-sdk/src/utils/composer/helpers/create-step-handler.ts:71:32)\n' +
' at async DistributedTransaction.handler (/root/backend-server/node_modules/@medusajs/orchestration/src/workflow/workflow-manager.ts:214:16)\n' +
' at async stepHandler (/root/backend-server/node_modules/@medusajs/orchestration/src/transaction/transaction-orchestrator.ts:827:20)\n' +
' at async Promise.allSettled (index 0)\n' +
' at async promiseAll (/root/backend-server/node_modules/@medusajs/utils/src/common/promise-all.ts:27:18)\n' +
' at async TransactionOrchestrator.executeNext (/root/backend-server/node_modules/@medusajs/orchestration/src/transaction/transaction-orchestrator.ts:965:7)\n' +
' at async executeNext (/root/backend-server/node_modules/@medusajs/orchestration/src/transaction/transaction-orchestrator.ts:1013:14)\n' +
' at async TransactionOrchestrator.resume (/root/backend-server/node_modules/@medusajs/orchestration/src/transaction/transaction-orchestrator.ts:1028:5)\n' +
' at async LocalWorkflow.run (/root/backend-server/node_modules/@medusajs/orchestration/src/workflow/local-workflow.ts:371:5)\n' +
' at async originalExecution (/root/backend-server/node_modules/@medusajs/workflows-sdk/src/helper/workflow-export.ts:111:26)\n' +
' at async newRun (/root/backend-server/node_modules/@medusajs/workflows-sdk/src/helper/workflow-export.ts:190:12)\n' +
' at async Function.exportedWorkflow.run (/root/backend-server/node_modules/@medusajs/workflows-sdk/src/helper/workflow-export.ts:417:12)\n' +
' at async Object.async.container.container (/root/backend-server/node_modules/@medusajs/workflows-sdk/src/utils/composer/create-workflow.ts:193:29)\n' +
' at async Object.invoke (/root/backend-server/node_modules/@medusajs/workflows-sdk/src/utils/composer/helpers/create-step-handler.ts:72:52)\n' +
' at async DistributedTransaction.handler (/root/backend-server/node_modules/@medusajs/orchestration/src/workflow/workflow-manager.ts:214:16)\n' +
' at async stepHandler (/root/backend-server/node_modules/@medusajs/orchestration/src/transaction/transaction-orchestrator.ts:827:20)\n' +
' at async Promise.allSettled (index 0)\n' +
' at async promiseAll (/root/backend-server/node_modules/@medusajs/utils/src/common/promise-all.ts:27:18)\n' +
' at async TransactionOrchestrator.executeNext (/root/backend-server/node_modules/@medusajs/orchestration/src/transaction/transaction-orchestrator.ts:965:7)\n' +
' at async executeNext (/root/backend-server/node_modules/@medusajs/orchestration/src/transaction/transaction-orchestrator.ts:1013:14)\n' +
' at async TransactionOrchestrator.resume (/root/backend-server/node_modules/@medusajs/orchestration/src/transaction/transaction-orchestrator.ts:1028:5)\n' +
' at async LocalWorkflow.run (/root/backend-server/node_modules/@medusajs/orchestration/src/workflow/local-workflow.ts:371:5)\n' +
' at async originalExecution (/root/backend-server/node_modules/@medusajs/workflows-sdk/src/helper/workflow-export.ts:111:26)\n' +
' at async LocalWorkflow.newRun [as run] (/root/backend-server/node_modules/@medusajs/workflows-sdk/src/helper/workflow-export.ts:190:12)\n' +
' at async POST (/root/backend-server/node_modules/@medusajs/medusa/src/api/store/carts/[id]/line-items/route.ts:11:3)\n' +
' at async /root/backend-server/node_modules/@medusajs/utils/src/common/wrap-handler.ts:17:14\n' +
'⮑ sat /root/backend-server/node_modules/@medusajs/core-flows/dist/cart/workflows/confirm-variant-inventory.js: [confirm-item-inventory -> confirm-inventory-step (invoke)]\n' +
'⮑ sat /root/backend-server/node_modules/@medusajs/core-flows/dist/cart/workflows/add-to-cart.js: [add-to-cart -> confirm-item-inventory-as-step (invoke)]',
__isMedusaError: true,
type: 'invalid_data',
code: undefined,
date: 2024-12-22T01:45:03.046Z
Package.json file
Node.js version
v20.15.0
Database and its version
PostgreSQL 16.4
Operating system name and version
Windows 11
Browser name
No response
What happended?
If your product variant has the settings: Managed Inventory = true and Allowed backorders = true, but no Stock Locations are added for Inventory Item of this variant and when you try to add it to cart you will get error 400: stack: 'Error: Sales channel sc_01JCHCH6E5ZF7760H5J5WFC4T3SZY is not associated with any stock location.\n'+'
It's how to reproduce the problem:
Expected behavior
It is expected that the variant will be added to the cart since the "Allowed backorders = true" option is enabled
Actual behavior
You're getting server error 400. Here is the full server error code.
(Actually the error sounds strange, because this sales channel has a connection to several Locations. It's just that these locations are not added specifically to our test case.)
Link to reproduction repo
https://github.com/medusajs/medusa/
The text was updated successfully, but these errors were encountered: