How to Remove SKU from a Product Page in Magento 2

How to Remove SKU from a Product Page in Magento 2

If you want to remove the SKU display from product pages in Magento 2, you can achieve this by overriding the default layout file in your theme. Here’s how you can do it step-by-step:

How to Remove SKU from Product Pages in Magento 2

If you're looking to remove the SKU from product pages in Magento 2, you can do so by customizing the layout XML. Here's how:

  • Create or Modify catalog_product_view.xml
  • Navigate to your theme's layout directory:

    app/design/frontend/VENDOR/THEME/Magento_Catalog/layout/

    Ensure the path is correct for your store before proceeding.

  • Insert the Code
  • Add the following XML code to your catalog_product_view.xml file:

    <?xml version="1.0"?>

    <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">

    <body>

    <referenceBlock name="product.info.sku" remove="true" /">

    </body>

    </page>

    This simple XML snippet will remove the SKU block from the product page.

  • Clear Cache
  • After saving the file, remember to flush Magento's cache for the changes to take effect. You can do this from the Admin Panel under System > Cache Management or using the command line.

Why Remove the SKU?

Removing the SKU from the product page can help declutter the display, particularly for non-technical customers who don’t need to see the SKU. For virtual products or services (like software), showing the SKU may not add any value.

This small change can lead to a cleaner and more streamlined user experience. If you're working with a highly customized Magento 2 setup, you may need to adapt the XML file path accordingly.

Tip

To enhance your eCommerce store’s performance with Magento, focus on optimizing site speed by utilizing Emmo themes and extensions. These tools are designed for efficiency, ensuring your website loads quickly and provides a smooth user experience. Start leveraging Emmo's powerful solutions today to boost customer satisfaction and drive sales!

FAQs

What is the Purpose of Removing SKU from a Product Page?

Removing the SKU can declutter the product page and create a cleaner user experience. This is particularly useful for businesses that don’t rely on SKU visibility for customers, such as service-based or virtual product stores.

How Do You Remove the SKU Using XML in Magento 2?

Create or modify the catalog_product_view.xml file in the layout directory of your theme. Add the XML code to remove the SKU block using the remove="true" attribute.

What is the Exact XML Code to Remove the SKU?

Use the following code:

        
        
            
                
            
        
        

Where Should the catalog_product_view.xml File Be Located?

Place the file in this path: app/design/frontend/VENDOR/THEME/Magento_Catalog/layout/. Replace "VENDOR" and "THEME" with your specific values.

What Steps Should Be Taken After Editing XML Files?

Clear Magento’s cache to apply the changes. This can be done via the Admin Panel under **System > Cache Management** or by running php bin/magento cache:flush in the command line.

Are There Risks to Removing the SKU from Product Pages?

If your business relies on SKUs for product identification or inventory management, hiding them could create challenges. Evaluate your business needs before implementing this change.

Is Removing the SKU a Reversible Process?

Yes, you can reverse the change by removing the remove="true" code from the XML file and clearing the cache again.

What Alternative Customizations Can Be Done to the SKU Block?

Instead of removing the SKU, you can customize its appearance or relocate it to another section of the product page by modifying the same XML file.