Description
Preconditions
- PHP 7.0.16
- MySQL 5.7
- Apache 2.4
- Magento 2.1.9 (I was able to recreate this w/ both the sample data and the data from my store)
Steps to reproduce
- Go into the admin panel and navigate to Stores->Attribute Set
- Edit the default attribute set, add a new group named 'Options', add a few attributes to the new group, and save the group
- Navigate toe Products->Catalog and choose any product with the default attribute set to edit
- Expand the Customizable Options section and click the 'Add Option' button
Expected result
- A new customizable option form should appear
Actual result
- Nothing happens on the page
- A 'Uncaught TypeError: Cannot read property 'apply' of undefined' error is thrown in the console
The full stack trace for the console error is:
Uncaught TypeError: Cannot read property 'apply' of undefined
at registry.js:54
at Registry._resolveRequest (registry.js:413)
at Registry._addRequest (registry.js:380)
at Registry.get (registry.js:224)
at async (registry.js:53)
at UiClass.applyAction (button.js:72)
at Array.forEach ()
at UiClass.action (button.js:50)
at HTMLButtonElement. (knockout.js:3863)
at HTMLButtonElement.dispatch (jquery.js:5226)
I traced it out and what is happening is there are two UIClass objects on the page with the same 'ns'=>'product_form' and 'index'=>'options' properties. This is occurring because the 'Options' attribute group we just created was given the attribute group code 'options' and that attribute group code appears to be the value that's used for the 'index' key in the resulting UIClass object. If we go back and delete the 'Options' group out of the attribute set, the button goes back to working like it should. I also tested out just renaming the group; however, it appears that the attribute group code is only set when the group is created. So changing the name later won't update the attribute group code.