What is the best way to create a custom generated field.
We need to accumulate the stock level of all variants in the same color.
So we have two variant groups (Color and Size). One product has multiple colors, and multiple sizes.
Each variant option of course have their own stock level, but we need to know the total stock level across all sizes on a particular color.
Thinking of creating a custom product field which hold this info, but what is the best way to populate this field?
Is it possible to populate this field during the index build, or what would be the best practice?