I've created a custom attribute yes/no with default value no.
If I update the product with custom attribute value yes then attribute should not be visible on the edit page, if with no value then should be visible.
How can we achieve this?
Thanks!
admincustom-attributesmagento2pageproduct
I've created a custom attribute yes/no with default value no.
If I update the product with custom attribute value yes then attribute should not be visible on the edit page, if with no value then should be visible.
How can we achieve this?
Thanks!
Best Answer
This is very simple, follow steps below :
Go to the file
Then you can remove/hide product attribute by function getMeta() in ProductDataProvider.php file on line 67
Try code below for hide/remove any attribute you want, you can check condition before hide/remove your attribute for case : (If I update the product with custom attribute value yes then attribute should not be visible on edit page, if with no value then should be visible), my example is price attribute
Full code
Check result before try my solution
Check result after try my solution
Let me know if you have any question !