-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issues creating a new product with a variant with money amount #5306
Comments
@ConnysCode – thanks for filing this issue. If you want to interface directly with our services instead of our Rest API, you'll need to create variants and their prices subsequent to creating the product. You can see the flow of events in the medusa/packages/medusa/src/api/routes/admin/products/create-product.ts Lines 170 to 256 in 441844e
|
Hey @olivermrbl We've been using this method to import products in our production service for several months, and it has just now suddenly stopped working (we did not even upgrade recently). Are you certain that it's not possible to create them in this way? If that's the case, could you please explain why Medusa doesn't catch this and omits the variants value when creating a new product? This seems especially puzzling because when updating a product, you can't include a variant as well. So, I don't see the point of including them in the creation interface. |
I might have found the culprit. In v1.16.0, we updated the relationship between money amounts (prices) and product variants from a many-to-one to a many-to-many. This was a breaking change. Can you check if the migration from this release has been run against your database? Try to run:
The change has been applied if you see a migration named Creating variants and prices directly using the I'll forward this to our team to see if we can add back the support for the updated schema. Until then, you'll have to use a combination of services to achieve this. You can use the handler I linked to in a previous message as source of inspiration. |
@olivermrbl Thanks for the info! Seeing this feature again would be amazing. It would've been nice, to see that breaking change in the upgrade info tho ^^ |
Bug report
Hi there,
It's been a while since we last reached out. I hope you're all doing well.
I'm writing to you today because we've encountered an issue with inserting new products in Medusa, and I could use some assistance in resolving it.
When attempting to create a new product, even with the most basic data, we've noticed that Medusa is not correctly handling the money amount. I want to clarify that I may be missing something obvious, but here's a simplified version of how we're trying to create a product:
However, it seems that the insert query is not capturing the money amount correctly. Here's the relevant error message we're encountering:
From what I understand, it appears that Medusa is trying to create a new relation with a default value for the money amount, when it should be set to 1 in this particular case.
Thank you very much for your help! ❤️
System information
Medusa version: v17.0.0
Node.js version: v20.5.1
Database: Postgresql
Operating system: MacOS 14.0
The text was updated successfully, but these errors were encountered: