Closed ybirader closed 8 months ago
I am trying to add a variant to the current cart using
const { cart } = await this.client.carts.lineItems.create( this.cartId!, { variant_id: variantId, quantity }, }
I get a 400 error. Inspecting the server logs, I get the following error:
Cannot generate line item for variant "T-Shirt" without a price.
I have added a price to the variant. To confirm this, I queried for the variant, which indeed shows that the amount field is set.
amount
Is there anything I need to ensure in order to add the variant to the cart?
A clear and concise description of what the bug is.
Medusa version (including plugins): @medusajs/medusa-js": "^6.1.7 Node.js version: 19 Database: PostgreSQL Operating system: MacOS Browser (if relevant):
@medusajs/medusa-js": "^6.1.7
The product variant should be added to the cart.
The code which raises the exception can be found at at LineItemService.<anonymous> /@medusajs/medusa/dist/services/line-item.js:402:27)
at LineItemService.<anonymous> /@medusajs/medusa/dist/services/line-item.js:402:27)
Can I get you to ensure, you have created a price in the currency (or region) of the cart?
Thank you!- that works.
Bug report
I am trying to add a variant to the current cart using
Describe the bug
I get a 400 error. Inspecting the server logs, I get the following error:
Cannot generate line item for variant "T-Shirt" without a price.
I have added a price to the variant. To confirm this, I queried for the variant, which indeed shows that the
amount
field is set.Is there anything I need to ensure in order to add the variant to the cart?
A clear and concise description of what the bug is.
System information
Medusa version (including plugins):
@medusajs/medusa-js": "^6.1.7
Node.js version: 19 Database: PostgreSQL Operating system: MacOS Browser (if relevant):Expected behaviour
The product variant should be added to the cart.
Additional Info
The code which raises the exception can be found at
at LineItemService.<anonymous> /@medusajs/medusa/dist/services/line-item.js:402:27)