I have created a custom category attribute using the custom code from here, attribute created successfully and able to save the value.

But I want to save store specific value in this custom attribute, So can save different value for English store view and Arabic store view.

I also try another way to create the custom category attribute, but no one saves store specific value.

I also found this issue on GitHub and try the given solution but not one is work for me.


4 Answers 4


Add below code in category_form.xml

<fieldset name="general">
        <field name="my_cat_desc" sortOrder="130" formElement="input">
                <label translate="true">My Cat Description</label>
                <scopeLabel>[STORE VIEW]</scopeLabel>


<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
     <type name="Magento\Catalog\Model\Category\DataProvider">
        <plugin name="category_color_data_mapping" type="Mynamespace\Mymodule\Model\Category\DataProvider" sortOrder="1" disabled="false"/>


namespace Mynamespace\Mymodule\Plugin\Category;

class DataProvider extends \Magento\Catalog\Model\Category\DataProvider
    public function __construct(
        Config $eavConfig
    ) {
        $this->eavConfig = $eavConfig;
    public function afterPrepareMeta(\Magento\Catalog\Model\Category\DataProvider $subject, $result)
        $meta = $result;
        $meta = array_replace_recursive($meta, $this->prepareFieldsMeta(
        return $meta;

    private function prepareFieldsMeta($fieldsMap, $fieldsMeta)
        $result = [];
        foreach ($fieldsMap as $fieldSet => $fields) {
            foreach ($fields as $field) {
                if (isset($fieldsMeta[$field])) {
                    $result[$fieldSet]['children'][$field]['arguments']['data']['config'] = $fieldsMeta[$field];
        return $result;
    protected function getFieldsMap()
        $fields = '';
        $fields['general'][] = 'my_cat_desc';

        return $fields;

This almost worked. A few changes in the given code made it work. First change the di.xml line :




Next include a

use Magento\Eav\Model\Config;

for the plugin class Mynamespace\Mymodule\Plugin\Category\DataProvider at the start of the class, add protected $eavConfig; or $this->eavConfig = $eavConfig won't work, and also change

$fields = '';


$fields = [];

With these changes I had it fixed. Thanks Nalin Savaliya


Please check "is_global" property in the database table catalog_eav_attribute for your custom attribute and make sure it is having value as 0. Then after your custom attribute one checkbox will appear "Use Default Value" in the admin. Unchecking that checkbox will help you to save attribute value store view level.

  • That is already set to 0 in catalog_eav_attribute table for my custom attribute, but still no luck. Jun 17, 2019 at 5:15

By default magento store the category attributes with the store id. So each category attributes can be save store wise.

In case of custom attributes, may some problem with the creation of attribute. You can go with below article which has a good knowledge base to create the category attribute.


Just make sure you mentioned the below piece of code in proper places:

'global'       => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE,


<item name="scopeLabel" xsi:type="string">[STORE VIEW]</item>

Also compare your new created attribute with existing one for below tables:

catalog_category_entity_int ( or text or varchar depends on your attribute type)



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.