Tutorialsplane

Magento 2 Display Category Products on Home Page


Magento 2 Display Category Products on Home Page It is very simple to display the Category products on home page in magento 2. You can display the products of any category on home page using category id.


Magento 2 Display Category Products on Home Page Example

Add the following code to your home page CMS to display the selected category products on home page.

Magento 2 Display Category Products on Home Page Example:

{{widget type="Magento\CatalogWidget\Block\Product\ProductsList"
         products_count="4" 
        template="product/widget/content/grid.phtml"
        conditions_encoded="a:2:[i:1;a:4:[s:4:`type`;    s:50:`Magento|CatalogWidget|Model|Rule|Condition|Combine`;s:10:`aggregator`;s:3:`all`;s:5:`value`;s:1:`1`;s:9:`new_child`;s:0:``;]s:4:`1--1`;a:4:[s:4:`type`;s:50:`Magento|CatalogWidget|Model|Rule|Condition|Product`;s:9:`attribute`;s:12:`category_ids`;s:8:`operator`;s:2:`==`;s:5:`
            value`;s:1:`your_category_id`;]]"}}

Where your_category_id is category id. In the above example pass the category id which you want to display on the home page.