0

how to remove sku on product page in magento2enter image description here

2
  • Thanks Thanks Thanks
    – sq y
    Oct 20, 2021 at 7:29
  • If answer help, upvote and accept as solution. so this will help other in community. Oct 20, 2021 at 7:39

2 Answers 2

1

Create layout file on your current theme fo the product page:

app\design\frontend\Vendor\Theme\Magento_Catalog\layout\catalog_product_view.xml

Then, added this code in the file:

<?xml version="1.0"?>
<page layout="1column" 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>
1

Method To Remove SKU from Product Page in Magento 2:

Create catalog_product_view.xml file at app\design\frontend\[Vendor]\[Theme]\Magento_Catalog\layout

Or in your module

app\code\[Vendor]\[Module]\view\frontend\layout

<?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>

That’s all to hide SKU from the product page in Magento 2.

For more info click here

2
  • Should this method be written in a custom module or in a theme? Why
    – sq y
    Oct 20, 2021 at 6:04
  • Yes you can add in your module also check updated code Oct 20, 2021 at 6:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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