What is the point of the additional_data
property?
#11783
AlexAntonides
started this conversation in
RFC
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everyone,
For quite a while now, I've been using the
additional_data
property to extend products and variants and to attach custom logic onto it using the API. This has been a positive experience. However, recently, I've been trying to attachadditional_data
using the create/update workflows and noticed that these workflows are quite limited in how they handle this data. Even simple tasks become frustrating. After digging into these workflows, I'm questioning whether I'm usingadditional_data
correctly, and ultimately, what its intended purpose even is.According to Medusa's documentation,
additional_data
should be used to link custom modules to commerce modules, for example, when creating a product,This works as expected through the API. However, I need to create seeds, which necessitates using workflows, and this is where the problem lies.
Examining the source code for the CreateProducts Workflow, I noticed that the
additional_data
is applied to all provided products, rather than allowing per-productadditional_data
.When creating seeds for my new models, I found that the create/update workflows apply
additional_data
to all entities in the request:Therefore, to apply different branding when creating products through a seed, I have to call the
createProductsWorkflow
for each product,This becomes even more cumbersome when needing to pass
additional_data
to variants during product creation, as this is not supported in the workflow or the API route. Consequently, for each product, I must also call the CreateVariants workflow,Why can't we simply define the
additional_data
per product and variant directly within thecreateProductsWorkflow
input, like this,Beta Was this translation helpful? Give feedback.
All reactions