Why translation is wrong after assigning article to a new shop?

Hello Everyone,

I currently work on e-commerce website powered with Shopware 5.3.6. Bug was reported that translation of some article attribute is not valid on frontend->detail page. After investigation I found that system makes translation for every variant with ‘variant’ key, and for main variant one more with ‘article’ key. When I edit some translation it works, and everything is shown fine in backend but if translation of main variant is edited after article is assigned to a new shop (and edited translation belongs to that shop) on the front view is incorect. It shows translation which is saved under ‘variant’ key, for main variant, but the one that is edited is actually translation saved under ‘article’ key. I checked all of plugins in the system none of theme deals with saving or presenting translations. Did any else had issue like this and it is solved?

This seems to be a Shopware 5.3.6 bug. Feel free to correct me if I am wrong. Normally, Shopware reads translation for variants where key is ‚variant‘ and for main variant where key is ‚article‘. Then when fetch result to show them on front he merges those 2 values if both are present in engine/Shopware/Bundle/StoreFrontBundle/Gateway/DBAL/Hydrator/ProductHydrator.php line  110 like 

 $translation = array\_merge($translation, $variant);

Because of this, value under key ‚variant‘ will have precedence over ‚article‘ key, wich is ok. But if you change main variant value under ‚variant‘ key is not deleted and then you will have problem with new main variant because it has value for both ‚variant‘ and ‚article‘. Then in the back of shop you edit ‚article‘ all the time, but on front is shown ‚variant‘ all the time. 

My fix was to switch main variants once more.