---
title: Category Navigation
slug: klevu-magento-v4/category-navigation
docTags: 
createdAt: 2024-09-23T15:18:41.534Z
---

When Category Navigation `Ordering & Rendering` is set the Klevu Theme is enabled for all Categories.&#x20;

This behaviour can be amended by injecting custom `isEnabledConditions` into the `isEnabledDeterminer`.

The default behaviour of the determiner for category navigation checks:

- If the store is integrated with Klevu
- If category navigation is enabled
- If the route is a category
- If the category is displaying products

:::CodeblockTabs
module-m2-frontend-categorynavigation/etc/di.xml

```xml
<type name="Klevu\FrontendCategoryNavigation\Service\Action\UpdateCategoryPageLayoutAction">
    <arguments>
        <argument name="isEnabledConditions" xsi:type="array">
            <item name="klevu_integrated"
                  xsi:type="object">Klevu\Frontend\Service\IsEnabledCondition\IsStoreIntegratedCondition</item>
            <item name="klevu_catnav_enabled"
                  xsi:type="object">Klevu\FrontendCategoryNavigation\Service\IsEnabledCondition\IsCatNavEnabledCondition</item>
            <item name="klevu_category_route"
                  xsi:type="object">Klevu\FrontendCategoryNavigation\Service\IsEnabledCondition\IsCategoryRouteCondition</item>
            <item name="klevu_category_display_products"
                  xsi:type="object">Klevu\FrontendCategoryNavigation\Service\IsEnabledCondition\IsCategoryDisplayingProductsCondition</item>
        </argument>
    </arguments>
</type>
```
:::

If all these return true, the category navigation layout handle will be added to the page.

### Enable for a subset of categories

Say we only wanted to enable Klevu's Category Navigation if the category ID was odd.

Inject your own `isEnableCondition`

:::CodeblockTabs
module-m2-frontend-categorynavigation/etc/di.xml

```xml
<type name="Klevu\FrontendCategoryNavigation\Service\Action\UpdateCategoryPageLayoutAction">
    <arguments>
        <argument name="isEnabledConditions" xsi:type="array">
            <item name="is_odd_category"
                  xsi:type="object">Vendor\Model\Service\IsEnabledCondition\IsCategoryOddCondition</item>
        </argument>
    </arguments>
</type>
```
:::

Create the Condition

:::CodeblockTabs
Vendor/Model/Service/IsEnabledCondition/IsCategoryOddCondition.php

```php
<?php

declare(strict_types=1);

namespace Vendor\Module\Service\IsEnabledCondition;

use Klevu\FrontendCategoryNavigation\Service\IsEnabledCondition;
use Klevu\Registry\Api\CategoryRegistryInterface;

class IsCategoryOddCondition implements IsEnabledConditionInterface
{
    public function __construct(CategoryRegistryInterface $categoryRegistry)
    {
        $this->categoryRegistry = $categoryRegistry;
    }
    
    public function execute(): bool
    {
        $category = $this->categoryRegistry->getCurrentCategory();
        
        return $category->getId() & 1;
    }
}

```
:::

See `module-m2-frontend-categorynavigation/Service/IsEnabledCondition` for more examples of `isEnabledDeterminer` classes.
