Tutorialsplane

Magento 2 Display Category Products on Home Page


Magento 2 Display Category Products on Home Page– Sometimes we need to display some specific category products on homepage. It is a little bit tricky to display the category products on Home Page. Here in this tutorial, we are going to explain how you can display the products from selected category on home page.


Magento 2 Display Category Products on Home Page Example

You can display the catgory products on Home page by using the following code-

Magento 2 Display Category Products on Home Page Example:

{{widget type="Magento\CatalogWidget\Block\Product\ProductsList"
        products_count="10" 
        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:`14`;]]"}}

In the above example 14 is the category id for which we need to get the list of products.

So replace 14 by your category id while using the above code. We hope the above example will help you and save your time.