Copy Category Names Between Magento Store Views (French → French) Safely and SEO-Smart
Copy Category Names Between Magento Store Views (French → French) Safely and SEO-Smart
A precise, production-ready method to duplicate only category names from one French store view to another in the same Magento instance, while protecting SEO signals.
Why this approach
- Targeted: Copies only the name attribute, nothing else.
- Safe & idempotent: Uses
ON DUPLICATE KEY UPDATEto update existing values without errors. - SEO-aware: Keeps URL keys, meta fields, and rewrites untouched, avoiding unexpected URL churn.
Prerequisites
- Confirmed IDs:
attribute_id (name)= 45source store_id(French) = 2target store_id(French) = 5
- Database backup created.
- CLI access to run reindex and cache commands.
Exact SQL (only category names)
Preview what will be copied (optional):
SELECT entity_id, value
FROM catalog_category_entity_varchar
WHERE store_id = 2 AND attribute_id = 45;Copy from store 2 to store 5:
INSERT INTO catalog_category_entity_varchar (attribute_id, store_id, entity_id, value)
SELECT 45 AS attribute_id, 5 AS store_id, entity_id, value
FROM catalog_category_entity_varchar
WHERE store_id = 2
AND attribute_id = 45
ON DUPLICATE KEY UPDATE value = VALUES(value);Why ON DUPLICATE KEY UPDATE?
Magento uses a unique key on (entity_id, attribute_id, store_id). If a row already exists in the target store, this clause updates the existing value instead of failing with a duplicate key error. This makes the operation safe to rerun and ensures full coverage.
Post-migration steps
Reindex and flush cache:
bin/magento indexer:reindex bin/magento cache:flush- Spot-check a few categories in the target French store view to confirm names rendered properly on the frontend and in the admin.
SEO notes (what this does & does not change)
- Does change: Localized category display names in the target store view.
- Does not change: URL keys, URL rewrites, category paths, meta title/description, canonical tags, or indexing settings.
- Why that’s good: Preserves existing URLs and avoids accidental SEO regressions from mass URL updates.
If you also want the target store to mirror localized URL keys or meta data, handle those separately to avoid unexpected rewrite explosions. Start with a small subset, regenerate rewrites carefully, and validate live URLs.
Troubleshooting & best practices
- No changes visible? Verify you’re viewing the correct store view on the frontend and in Admin. Confirm the row exists for
(entity_id, attribute_id=45, store_id=5). - Mixed languages? Ensure categories don’t have fallback/global values conflicting with the target store’s localized value. The store-scoped row should override the default.
- Future-proofing: You can safely rerun the same SQL after creating new categories in the source store view—existing target rows will update, new ones will insert.