Confusion about store_id in Magento 2 database

Confusion about store_id in Magento 2 database

August 27, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Confusion about store_id in Magento 2 database

Understanding Magento 2 Store_id Confusion

Hello fellow developers! I recently received an interesting question from a Magento user who is experiencing some confusion around the store_id in their database after migrating data from Magento 1 to 2. Let’s dive into this issue and find a solution.

The Scenario

Our user has a Magento 2.1 installation with two stores: one active (“My Second Store”) and another default store that is not really used. They migrated data from a previous Magento 1.9.x install, which seemed to go smoothly. However, they are now facing some challenges with the store_id in their database.

Here’s what the tables look like:

store table:

store_id = 0, code = admin, website_id = 0
store_id = 1, code = default, website_id = 1
store_id = 4, code = mysecondstore_english, website_id = 3

store_website table:

website_id = 0, code = admin, name = "Admin"
website_id = 1, code = base, name = "Main Website"
website_id = 3, code = mysecondstore, name = "My Second Store"

The Issue

When editing products in the catalog, our user found that there were duplicate entries in many of the catalog_product_entity_xxxxxxxx database attribute tables. These duplicates had a store_id of 4, while the original entries had a store_id of 0.

This led to two problems:

  1. Changes made to products from the Magento admin panel didn’t show up on the active store (with store_id = 4) because by default, it edits the attributes with store_id = 0.
  2. The user had to make manual changes in the database to update product information.

The Confusion

The user is unsure which store_id they should use and exactly which tables need to be modified besides the attribute tables. They believe that using store_id = 4 might cause products to disappear from the active store.

The Solution

To resolve this issue, we need to understand Magento’s multi-store architecture and how the store_id works in version 2.

Understanding Multi-Store Architecture

In Magento 2, each store is associated with a website, which is further associated with groups. This hierarchical structure allows you to manage multiple stores efficiently.

  • Website: Represents a group of stores that share common settings.
  • Group: Allows you to create different product catalogs for your websites.
  • Store: The individual online storefront where customers shop.

Identifying the Correct store_id

In our user’s case, they should focus on the active store with store_id = 4. This is the store associated with their second website and group. To ensure that products are displayed correctly on this store, we need to make sure that the relevant product attributes have a store_id of 4 in the corresponding database tables.

Updating the Database

To fix the issue, follow these steps:

  1. Identify all the catalog_product_entity_xxxxxxxx tables where you have duplicate entries with both store_id = 0 and store_id = 4.

  2. For each product that needs to be displayed on the active store (with store_id = 4), update the relevant attribute values in the corresponding tables, ensuring that the store_id column is set to 4.

  3. After updating the database entries, clear the cache and reindex your catalog.

Conclusion

In summary, the user’s confusion arises from the multi-store architecture of Magento 2 and the handling of product attributes across different stores. To resolve the issue:

  • Identify the correct store_id for the active store.
  • Update the relevant product attribute values in the database tables with the appropriate store_id.
  • Clear cache and reindex the catalog.

By following these steps, our user should be able to display their products correctly on the active store without needing to make manual changes in the database after every edit.

Magento 2 Magento 1 Catalog Database

Our network