We see the same behaviour in 2 of our installations, both running 2.1.1.
The issue is caused when passing the configurable matrix for a second (or nth-time) to the controller via Ajax. The saveFormHandler in variations.js (in the ConfigurableProduct module) serialises the configurable-matrix value to configurable-matrix-serialized, but deletes the original configurable-matrix value afterwards. When the save button is pressed a second time, the configurable-matrix value will be empty and no simple products will be linked via the controller action.
Issue can be solved by editing the saveFormHandler in variations.js (https://github.com/magento/magento2/blob/develop/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/variations.js#L306)
saveFormHandler: function() {
this.source.data["product"]["configurable-matrix-serialized"] =
JSON.stringify(this.source.data["configurable-matrix"]);
~ //delete this.source.data["configurable-matrix"];
Thanks for the additional information fowbi, hopefully Magento will sort this issue out with your fix.
@samgranger, thanks for reporting this issue.
We've created internal ticket MAGETWO-61608 to address this issue.
@fowbi @samgranger
For some reason, I cannot find the variations.js file under the file structure you reference above. I can go as far as html/app however, the /code folder does not exist. Where can I properly find this file in order to fix this annoying bug?
@samgranger, thank you for your report.
We've created internal ticket(s) MAGETWO-69704 to track progress on the issue.
It's really worst than what you could think. If the admin validation has any error (like an empty title) and you click on save, than fix the title and click on save again ... BAM!
You lose all your configurables data!
The problem has been introduced in 2.1.1 with the following commit https://github.com/magento/magento2/commit/b75fc4f83aa2fdf093ceae25449fa0b95bbc4020
If someone need a fix for Magento 2.1.10, here is a patch: https://raw.githubusercontent.com/Hevelop/magento2-patches/master/Patch-Magento_ConfigurableProduct-M2.1.10-delete-simple-products-on-validation.patch
Hi @engcom-Echo. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.[ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.
[ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
[ ] 4. Verify that the issue is reproducible on 2.4-develop branchDetails
- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!
[ ] 5. Add label Issue: Confirmed once verification is complete.
[ ] 6. Make sure that automatic system confirms that report has been added to the backlog.
Hello All
I am not able to reproduce this issue on the 2.4-develop branch by provided steps.
Testing scenario:
Preconditions:
Steps to reproduce:
Result
Current variations are not disappear

So I have to close this issue.
Thanks for your report!
Most helpful comment
The issue is caused when passing the configurable matrix for a second (or nth-time) to the controller via Ajax. The saveFormHandler in variations.js (in the ConfigurableProduct module) serialises the configurable-matrix value to configurable-matrix-serialized, but deletes the original configurable-matrix value afterwards. When the save button is pressed a second time, the configurable-matrix value will be empty and no simple products will be linked via the controller action.
Issue can be solved by editing the saveFormHandler in variations.js (https://github.com/magento/magento2/blob/develop/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/variations.js#L306)