The site default language is traditional Chinese.
Upon adding a product (in Chinese) of a product type, after clicking Save and publish, a new page with the following error would be prompted: The website encountered an unexpected error. Please try again later.
However, the /admin/commerce/products page showed that the product had been added.
Two errors were logged:
1. Message Warning: Invalid argument supplied for foreach() in Drupal\commerce_product\Entity\Product->postSave() (line 301 of /srv/bindings/615321ab035a455f92f948b22c68d3e1/code/web/modules/contrib/commerce/modules/product/src/Entity/Product.php) #0
2. InvalidArgumentException: Field variations is unknown. in Drupal\Core\Entity\ContentEntityBase->getTranslatedField() (line 471 of /srv/bindings/615321ab035a455f92f948b22c68d3e1/code/web/core/lib/Drupal/Core/Entity/ContentEntityBase.php
Comments
Comment #2
mglamanWe have errors surrounding content_translation, this might be related to something in the queue. Any help debugging would be great.
In postSave we ensure variants have a valid backreference.
Apparently this seems to explode when translations are enabled.
Comment #3
agoradesign commentedhmm, I do have a multi-lingual site up and running. both product entities and variations are translatable. I never experienced this problem. But I think, I have never really created a product via UI because everything is coming via migrate...
Comment #4
mglamanWe really need i18n test coverage
Comment #5
bojanz commented