Magento Layered Nav - Checkboxes

Magento Layered Nav - Checkboxes

October 1, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento Layered Nav - Checkboxes

Making Magento Layered Navigation Checkbox-friendly

As an experienced Magento developer, I often get inquiries about customizing the layered navigation experience to include checkbox-style filters, similar to popular online retailers like ASOS. While there are third-party modules available for purchase that claim to achieve this functionality, it’s possible to implement a custom solution using built-in features and some additional coding.

Understanding the Problem

The default Magento layered navigation uses radio buttons or dropdowns for filter selection. If you want to allow users to select multiple options within the same category (e.g., allowing them to check ‘black’ AND ‘red’ in color filters), the layered navigation needs to be rewritten with checkboxes instead.

The Custom Layered Navigation Approach

To create a custom layered navigation with checkboxes, you need to override the existing layered navigation block. Here’s an outline of the steps involved:

  1. Create a new module using Magento’s standard extension structure.
  2. Declare your dependency on Magento_Catalog and other related modules in the module.xml file.
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Your_Company_LayeredNavCheckboxes" setup_version="1.0.0">
        <sequence>
            <module name="Magento_Catalog"/>
        </sequence>
    </module>
</config>
  1. Create a di.xml file in the etc folder to inject your custom block into the layout.
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:app/config/xsd/di.xsd">
    <type name="Magento\Catalog\Block\Product\LayeredNavigation">
        <arguments>
            <argument name="layerFilterBlockTemplate" translate="true" xsi:type="string">Your_Company_LayeredNavCheckboxes::layer/filter.phtml</argument>
        </arguments>
    </type>
</config>
  1. Create a filter.phtml file in the template folder of your module to render the checkboxes.
<div class="block layered-nav">
    <h2 class="subtitle"><?= $name ?></h2>
    <div class="layered-content">
        <?= $html; ?>
    </div>
</div>
  1. In the filter.phtml file, loop through each option and render it as a checkbox.
<?php foreach ($options as $_option): ?>
<div>
    <input type="checkbox" id="layered_<?= /* @escapeNotVerified */ $_option->getFilter()->getRequestVar() ?>"
           value="<?= /* @escapeNotVerified */ $_option->getValue() ?>" title="<?= /* @escapeNotVerified */ $_option->getLabel() ?>"
           name="<?= /* @escapeNotVerified */ $_option->getFilter()->getRequestVar() ?>"
           class="checkbox layered-filter-<?= /* @escapeNotVerified */ strtolower($_option->getFilter()->getRequestVar()) ?>"
           <?php if ($_option->getIsChecked()): ?>checked="checked"<?php endif; ?> />
    <label for="layered_<?= /* @escapeNotVerified */ $_option->getFilter()->getRequestVar() ?>"><?= /* @escapeNotVerified */ $_option->getLabel() ?></label>
</div>
<?php endforeach; ?>
  1. Clear the cache and refresh your catalog.

Additional Considerations

Keep in mind that this is a basic example, and you may need to adjust the code based on your specific Magento version and custom theme structure. Additionally, make sure to test the functionality thoroughly after implementation to ensure it works correctly with your existing configuration.

For more advanced customizations or if you encounter any issues during the development process, feel free to reach out to our team of experienced Magento developers at https://laravelcompany.com/magento-development/.

Conclusion

Creating a custom layered navigation with checkboxes in Magento involves overriding the existing block and rendering each option as a checkbox. By following the approach outlined above, you can provide your customers with a more intuitive filtering experience, similar to popular online retailers.

Remember that proper testing is crucial after implementing any custom module to ensure it doesn’t interfere with other functionalities or cause any performance issues. If you find yourself in need of professional assistance during this process, don’t hesitate to contact our team at Laravel Company for expert Magento development services.

Happy coding!

Catalog Extensions Configuration Errors

Our network