I've got multiple collections running a 2-way sync with Medusa.
If the locale is default, I want it to send the entire data within a BeforeChange hook. When the locale is not default, I only want it to sync data which is not localized.
So, I'm hoping to use a function that receives the data, collection and locale from within a hook and if locale !== process.env.DEFAULT_LOCALE, remove any fields that have localized: true on them.
I can easily make one that manually works for each individual collection, but figured I'd ask to see if anyone already has a solution, or function already that does this. I'm sure a perfectly reusable function that works with any collection would be quite a bit of work, when considering that you may have many nested items and situations where there are tabs with labels, or names, meaning that the api data returned can be quite different. The idea would be that the api response shape does not change at all; localized fields would simply disappear.
Kind of a long shot I guess 😅 maybe I'm over thinking it and there is a simple solution?