I need to disable Sku from the dashboard and not from the code, is this possible? enter image description here

  • in product edit page you want to disable sku text field ??? – Rk Rathod Feb 18 at 13:05
  • sorry, a mistake from my side. needed disable sku from dashboard – Robinio Feb 18 at 13:22
  • dashboard means ? – Rk Rathod Feb 18 at 13:22
  • i mean admin panel – Robinio Feb 18 at 13:24
  • admin panel means edit product page ?? – Rk Rathod Feb 18 at 13:28
  1. First of all, by default there is no way to disable SKU in the admin panel.
  2. Second, if you think that disabling sku from backend will make it disabled in the frontend thats not possible without modifying the code. Just make modifications in the code.
  3. Log into your server or navigate in your localhost directory.
  4. Locate the following file: /your_magento_root_directory/app/design/frontend/Vendor/VendorTheme/Magento_Catalog/templates/product/view/attribute.phtml
  5. If you don't have a custom theme then make modifications in the vendor and check.
  6. Override in vendor line 31: /your_magento_root_directory/vendor/magento/module-catalog/view/frontend/templates/product/view/attribute.phtml

Replace the original code

if ($_attributeLabel && $_attributeLabel == 'default') {
    $_attributeLabel = $_product->getResource()->getAttribute($_code)->getStoreLabel();

With the following:

if ($_attributeLabel && $_attributeLabel == 'default') {
    $_attributeLabel = $_product->getResource()->getAttribute($_code)->getStoreLabel();
    if ($_attributeLabel=='SKU') {
  1. After this run php bin/magento cache:flush or from admin panel.
  2. Confirm that its working or not.
  3. If you want to override this in app then just make a file in your custom theme i.e. /magento_root_directory/app/design/frontend/Vendor/VendorTheme/Magento_Catalog/templates/product/view/attribute.phtml
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.