Guide on real world approach to handling global and category based product attributes #13032
Replies: 2 comments 5 replies
-
Thanks for sharing @NicolasGorga . I believe this is possible using links, subscribers, etc... however, not necessarily in the same details you mention. You would still have to create copies of options and their values to ensure everything in the admin and Medusa's commerce flows work as expected. Otherwise, to customize Medusa with all the details mentioned, you'll probably have to do something more extreme like re-creating the product module or using a different Medusa Admin, as I mentioned. Maybe other members on the team have better ideas, though. I can look into writing a guide around the first approach, especially if it's something heavily requested. |
Beta Was this translation helpful? Give feedback.
-
Hey @NicolasGorga, first of all, thanks for taking the time to write such a detailed message and for sharing your thoughts on this. You are right that the current design of product options is sub-optimal, and we agree it needs to be improved. We plan to spend time redesigning the product options model in the coming months. Our focus will be on enabling global options that can be defined once and reused across products and variants. This will not only eliminate duplication but also improve the developer experience when working with product options in the storefront, e.g. by allowing filtering by global options. Once we have scoped out the changes, I will share our thoughts on the design here for feedback. Your input would be super valuable, I am sure. Thanks again for raising this and contributing to the discussion. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
For the longest time, i still feel one of the main weakness of the current implementation of the Product upsert flow, is the bridge it has to how one would actually need / expect product attributes to be defined and linked to a Product.
Currently, the ProductOption (attributes) is linked to the product and the ProductOptionValue to the variant. Also, the create Product form of the Admin UI expresses this relationship, since it makes you define the ProductOptions, along with their ProductOptionValues, when creating the product. The latter will be used to create the Variants of the product, by selecting the different combinations that make up the permutations.
In a practical sense, I don't see how this aligns to reality of real world products and the attributes that compose them:
This forces one, for attributes (ProductOptions) like color, size, etc, and their attribute values (ProductOptionValues) like red, green, M, L, etc to define them over and over again.
Apart from the previous point which makes the creation process time consuming, you end up with a lot of duplication in the DB for the same thing, roughly (Cnt products * Avg Options per Product * Avg Option Values per Product Option)
In reality it makes more sense for attributes and their values to be defined globally (those attributes that are common to all products, decision being up to the merchant, i.e: for a clothing store, such attribute would be Color). Also, allowing to link attributes to Category, so they can be applied and / or enforced (for those required) to products linked to the specific category
For the last point, the core create Product form should also be changed and Category input be placed at the same level as the one that defines the attributes, as you first need to select the category, to then get the attributes dynamically (global + selected category attributes).
At this point, the product could be linked to the attributes selected (similar to ProductOption) and the variants would only be linked to the combination of attribute values selected, so you only link in the DB what is needed, but show all the options at the form (UI level).
I made a plugin to try to solve this partially, although currently its implemented for unique products, so the attribute values are linked at the Product level, and i create just the default variant needed by the core with no ProductOption and ProductOptionValue. I am planning to change this, to better represent what i state here, linking the attribute values with the variant. But, this still forces me to fork the admin UI even though i would not change anything else from it, just to bypass this issue.
Apart from asking for somebody from the core team to get involved in the conversation, i would like, if i am missing something and there is already a solution for this, for maybe Shahed to amke a guide showing how to tackle this in the backend + UI.
Below is my implementation in a forked admin ui i made for my vintage clothing store marketplace. I really do believe that this may be one of the weakest, if not the most problematic aspect i find currently with the framework.
screen-capture.11.webm
Beta Was this translation helpful? Give feedback.
All reactions