---
title: Custom Attribute Name Prefix
slug: klevu-magento-v4/entities-custom-attributes-name-prefix
docTags: 
createdAt: 2024-08-15T16:06:41.153Z
---

As Magento has separate attributes for products and categories and these attributes can have the same name. Klevu does not differentiate attributes between entity types and therefore a name clash could occur with category and product attributes overwriting each other. To mitigate this we have added a prefix to any custom category attributes. By default this prefix is set to `cat__`.

:::CodeblockTabs
module-m2-indexing-categories/etc/di.xml

```xml
<virtualType name="Klevu\IndexingCategories\Service\Mapper\MagentoToKlevuAttributeMapper"
             type="Klevu\Indexing\Service\Mapper\MagentoToKlevuAttributeMapper">
    <arguments>
        <argument name="entityType"
                  xsi:type="const">Magento\Catalog\Api\Data\CategoryAttributeInterface::ENTITY_TYPE_CODE</argument>
        
        <!-- CATEGORY ATTRIBUTE PREFIX -->
        <argument name="prefix" xsi:type="string">cat__</argument>
        
        <argument name="attributeMapping" xsi:type="array">
            <item name="path" xsi:type="string">categoryPath</item>
            <item name="url_key" xsi:type="string">url</item>
        </argument>
    </arguments>
</virtualType>
```
:::

:::hint{type="info"}
The prefix only applies to custom attributes. Klevu standard attributes are not prefixed.
:::

You are free to change this prefix like so

:::CodeblockTabs
Vendor/Module/etc/di.xml

```xml
<virtualType name="Klevu\IndexingCategories\Service\Mapper\MagentoToKlevuAttributeMapper">
    <arguments>
        <argument name="prefix" xsi:type="string">prefix_</argument>
    </arguments>
</virtualType>
```
:::

:::hint{type="info"}
Note: The prefix is limited to underscores and alphanumeric characters only.
:::

:::hint{type="warning"}
If you change the prefix you’ll also need to ensure that any `cat__attribute_code` references in your pipeline YMAL files and/or frontend search requests are updated with the new prefix.
:::

