Add Custom Category Display Mode

Would you like to extend the default Magento category's display mode and add a new custom one? Let's see how you can easily create a custom category view!

The options for the category attribute display_mode are coming from the function getAllOptions() of the class

Magento\Catalog\Model\Category\Attribute\Source\Mode

So we can easily extend this function adding our custom mode by using the Magento plugins as you can see below

and using the after plugin method we can add our new custom mode

In Magento admin category view we can see the new option

The full example as extension can be found here.

Feel free to share this post and ask your questions in the comments below.

Till next time!