Magento – Magento2 : Change custom attribute scope not working

magento2product-attributescope

I create a product custom attribute programatically. The scope was WEBSITE. But now I just realised that this attribute must have the scope as STORE, because I need different values according to the store view.

I changed the scope in backend, clean the cache, and when I went to edit the product, the scope was correct [STORE]. Then I change store, view so I can insert the value for the store view and the scope changed to [WEBSITE].

I went back and the scope was wrong again [WEBSITE].

I went again to the attribute (Stores > Attributes > Product), choose my attribute, and the attribute had the right scope. I didn't change anything, only save the attribute again and clean the cache. Then I edit the product and the scope was correct [STORE], then I change store view and the scope was wrong again [WEBSITE].

I check database and the attribute is ok.

Did this happening to anyone?
Anyone has a clue about this?

Thank you

Best Answer

You've probably solved your problem, but here is solution for people coming here from google as me. I've managed it by editing it straight in database.

It's not recommended to do such things - the safest way is to delete this attribute and add it again, but sometimes you have no choice. This is e.g. how to change attribute scope to GLOBAL.

UPDATE catalog_eav_attribute SET is_global = 1, apply_to = 'simple,virtual,configurable' WHERE attribute_id = YOUR_ATTRIBUTE_ID;

And then refresh cache.