0

I want to set custom template file for different categories.

How to set custom phtml file for different categories using XML file?

Any help would be appreciated.

1 Answer 1

1

For that, you need to create xml file under Your_Theme/Magento_Catalog/layout and create file catalog_category_view_id_{{id}}.xml.

For ex : For creating different view for category with id 10 then, create catalog_category_view_id_10.xml. In that, you can call template file.

catalog_category_view_id_10.xml :

<referenceContainer name="content">
        <block class="Magento\Catalog\Block\Product\ListProduct" name="category.products.list" as="product_list" template="Magento_Catalog::product/custom.phtml"/>    
     </referenceContainer>

Hope, it will helpful for you.

0

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.