Store ID 0 for Attributes Added Programmatically – Magento 2 Issue

attributesmagento2scopestore-view

I have one website and one store. When I add product from admin, with some programatically added attributes (for example in table catalog_product_entity_int), they get store_id 0 (adminhtml). Is that ok?
Has it some negative consequences if later I want to add some store views for some other languages?

Best Answer

This is normal behavior. Store id 0 means "default values".
When retrieving a value for an attribute, Magento does something like this.

Do I have a value for the current store view id.?

  • Yes: I use that.
  • No: Do I have a value for the store view id 0?
    • Yes: I use that
    • No: Use null.

So if you later add other store views and add values for those store views, they value for store id 0 will be ignored.