1

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

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.

  • In the theme there is no code like above code. – Moin Malek Dec 28 '16 at 9:47
  • 1
    Yes it is there. Open the given xml file – Mrunmay Deswandikar Dec 28 '16 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 Dec 28 '16 at 9:58
  • HOw to fix it?? – Moin Malek Dec 28 '16 at 9:58
1

Create your own layout file for the product page:

app\design\frontend\**your_theme**\theme\Magento_Catalog\layout\catalog_product_view.xml

Then, paste this code in the file:

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<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>

This way, you can remove the SKU block without override any file

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

:)

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

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.