Magento2 Multiple Category Layouts

Magento2 Multiple Category Layouts

July 22, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento2 Multiple Category Layouts

Creating Custom Category Layouts in Magento 2

As an experienced developer who has worked extensively with both Magento 1.x and 2.x, I understand your frustration when trying to apply category-specific layouts. While Magento 2 offers enhanced functionality, it also introduces changes that can be challenging for those transitioning from the previous version.

Understanding Layouts in Magento 2

In Magento 2, the layout system is more structured than before. Layout updates are no longer directly managed within the XML files but rather through the “layout” configuration under the Magento_Theme module.

Step-by-Step Guide to Custom Category Layouts

To create a custom category layout in Magento 2:

  1. Create a New Theme File First, you need to create a new theme file that will serve as the base for your custom layouts. This can be done by copying the Magento_blank or Magento_luma themes and renaming them appropriately.

    /app/design/frontend/CustomTheme/magento Blank
    
  2. Add Your Custom Layout File Next, create a new layout XML file inside your theme’s app/design/frontend/[Vendor]/[Theme]/layout/ folder. For example:

    /app/design/frontend/CustomTheme/catalog_category_view.xml
    
  3. Define Your Category Layout

    In the catalog_category_view.xml file, define your custom layout. Here’s a basic example:

    <?xml version="1.0"?>
    <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <update handle="catalog_category_default"/>
        <body>
            <!-- Add your custom layout updates here, for example -->
            <referenceContainer name="content">
                <block class="Magento\Cms\Block\Block" before="-">
                    <arguments>
                        <argument name="block_id" xsi:type="string">category_description</argument>
                    </arguments>
                </block>
            </referenceContainer>
        </body>
    </page>
    
  4. Apply the Layout to a Category

    To apply this layout to a specific category, go to your Magento backend and navigate to Content > Design > Configuration.

    • Click on “Edit” for the store view you want to modify.

    • Scroll down to the “Layout Update XML” field under the “Design Theme” section.

    • Add the following code:

      <referenceContainer name="catalog_category_view">
          <update handle="catalog_category_view_custom"/>
      </referenceContainer>
      

    Replace catalog_category_view_custom with the name of your layout file (excluding the .xml).

  5. Flush Cache and Test

    After saving, flush your Magento cache (bin/magento cache:flush) and navigate to your category page to see if the changes have taken effect.

Conclusion

While Magento 2’s layout system may seem more complex compared to its predecessor, it offers greater flexibility and improved performance. By understanding how to create custom themes and apply layout updates using catalog_category_view.xml files, you can achieve a unique look for each category in your store.

Remember to always flush the cache after making changes, and consider using version control systems like Git to manage your theme files effectively.

For more detailed tutorials on Magento 2 development, I recommend exploring the resources available at Laravel Company.

Magento 2 Magento 1 Catalog Extensions

Our network