'When trying to edit a configurable product ... lost on this error... how to fix it

Notice: Undefined offset: 0 in /home/magento2/www/vendor/magento/module-configurable-product/Model/Product/Type/VariationMatrix.php on line 43



Solution 1:[1]

Error

Notice: Undefined offset: 0 in vendor/magento/module-configurable-product/Model/Product/Type/VariationMatrix.php on line 43

Process

We were importing a csv with column "configurable_variations" and values = "sku=costdai-ama-dail-p10-moon-stone-sp0000,sphere=0.00,contact_lens_color_name=Moon Stone| sku=costdai-ama-dail-p10-moon-stone-sn0050,sphere=-0.50,contact_lens_color_name=Moon Stone"

Solution and Reason

The reason of above error is the child product (costdai-ama-dail-p10-moon-stone-sp0000) does not have values assigned for attribute "contact_lens_color_name=Moon Stone"

So if we set the values to child product and try reimporting again. The parent product will be created with 2 child products assigned. We can see the child products on admin when we edit the parent product, under Configurations -> Current Variations

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Vaseem Ansari