Monday, 31 October 2016

Magento2: how to remove the mini cart icon from the menu

using layout xml file we can remove the mini cart icon from the menu in magento2

here is code
<referenceBlock name="minicart" remove="true" />
use this is any default.xml file to remove in all pages.

Thursday, 27 October 2016

Magento2: How remove a element from the template?

Hello Guys
Welcome to Magento2.. keep learning magento2

Today i found one thing
We can easily remove the element from the frontend templates with out touching phml files

go to layout file of page(module) then add this tag
<referenceBlock name="blockname" remove="true"/>

Example:
i would like remove sku, price from the product details page
I have done this
go to app\design\frontend\yournamespace\yourtheme\Magento_Catalog\layout\catalog_product_view.xml

i have added
<referenceBlock name="product.info.stock.sku" remove="true"/>
<referenceBlock name="product.info.price" remove="true"/>
under body tag.
sku and price are removed from the page.

if you dont have xml file in ur theme just copy from the base, place it in your theme.
you can get base file from vendor\magento\module-catalog\view\frontend\layout\catalog_product_view.xml

Please let me know if you need any help.

Thanks