1

I want to remove the SKU from the product display page. How can I do this?

4 Answers 4

3

To remove it just from the view, copy the following file:

vendor\magento\module-catalog\view\frontend\layout\catalog_product_view.xml

to your template folder, which should be something like this:

app\design\frontend\[your_theme]\theme\Magento_Catalog\layout\catalog_product_view.xml

Then remove the following block of code (should be somewhere around line 36)

<block class="Magento\Catalog\Block\Product\View\Description" name="product.info.sku" template="product/view/attribute.phtml" after="product.info.type">
  <arguments>
    <argument name="at_call" xsi:type="string">getSku</argument>
    <argument name="at_code" xsi:type="string">sku</argument>
    <argument name="css_class" xsi:type="string">sku</argument>
    <argument name="at_label" xsi:type="string">default</argument>
    <argument name="add_attribute" xsi:type="string">itemprop="sku"</argument>
  </arguments>
</block>

And replace it with:

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

clear the cache, and the SKU should be removed from the product view.

4
  • In the theme there is no code like above code.
    – Moin Malek
    Commented Dec 28, 2016 at 9:47
  • 1
    Yes it is there. Open the given xml file Commented Dec 28, 2016 at 9:56
  • <referenceContainer name="sidebar.additional"> block class="Magento\Cms\Block\Block" name="fasony-custom-block" after="-"> <arguments> <argument name="block_id" xsi:type="string">fasony-custom-block</argument> </arguments> </block> <block class="Magento\Cms\Block\Block" name="fasony-sidebar-banner" after="-"> <arguments> <argument name="block_id" xsi:type="string">fasony-banner-sidebar</argument> </arguments> </block> </referenceContainer>
    – Moin Malek
    Commented Dec 28, 2016 at 9:58
  • HOw to fix it??
    – Moin Malek
    Commented Dec 28, 2016 at 9:58
0

Create a new file catalog_product_view.xml in your theme

and paste the following code:

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

then run following commands to flush the cache

php bin/magento cache:flush

php bin/magento cache:clean

0

Go to app/design/frontend/default/your theme/template/catalog/products/view.html

Just add command line

enter image description here

:)

7
  • Sir I am working On Magento 2.1
    – Moin Malek
    Commented Dec 28, 2016 at 11:27
  • Then Above Path is not working
    – Moin Malek
    Commented Dec 28, 2016 at 11:27
  • How to use in Luma Theme
    – Moin Malek
    Commented Dec 28, 2016 at 11:55
  • Find view.html path, do as same as what I did.
    – Gem
    Commented Dec 28, 2016 at 12:19
  • It is not in the html file it is in the xml file
    – Moin Malek
    Commented Dec 28, 2016 at 13:26
-4
  1. Go to Admin > Catalog >Attributes > Manage Attributes sets > And remove SKU field
5
  • and move that SKU field to unassigned attributes which is at right section. Commented Dec 28, 2016 at 9:21
  • How to remove in Magento 2.1
    – Moin Malek
    Commented Dec 28, 2016 at 9:26
  • yes it is mentioned in my second answer. It will surely work in magento 2. Commented Dec 28, 2016 at 9:29
  • I want in the home page that doesnot shows the sku
    – Moin Malek
    Commented Dec 28, 2016 at 9:44
  • It is only shows in the admin section only
    – Moin Malek
    Commented Dec 28, 2016 at 9:44

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.