Magento 2 category IDs differ between staging and production. How do you prepare the import?

2 min read

Two silver racks linked by thin brass strips with a single burgundy tile

On staging, ID 42 refers to Root/Lighting/Table. On the destination installation it points to Root/Tools, while the intended category has ID 81. The dry run can succeed with either number. Compare the report with a category map to verify the intended destination.

Record both IDs and full paths

Export categories from both installations. Record the full paths, corresponding IDs and parent category in the destination store view. A path is built from category names in that view. In this example, staging parent 17 maps to destination parent 24. The table uses a test catalog with module version 1.0.5.

How module 1.0.5 resolved four test rows
ModeCSV IDResolved target or parentDry-run result
update4242 · Root/ToolsSuccess, different category
update8181 · Root/Lighting/TableSuccess, intended category
update99—Error, ID does not exist
insert2424 · Root/LightingSuccess, parent of new category

Use the destination ID for an update

In update mode, supply the destination entity_id. When present, it takes precedence even if category_path points elsewhere. An ID that does not exist causes an error. If you leave the ID field empty, supply the full destination path and confirm it identifies exactly one category.

Keep new categories in a separate file

For a new Root/Lighting/Wall, use insert in a separate file. Select the name attribute, supply the name and new path, and use the destination parent in parent_entity_id. With that ID field empty, the module resolves parent_path. Use a path that does not already exist. Module documentation.

Compare the dry-run report with the map

Select the intended Store View in the form and match it to store_view_code. Compare the report’s row number and identifier with your map. In the example, success for ID 42 meant a different category was found. Verify the category or parent in the destination tree before applying changes.

Export Import Categories module · Magento 2 category dry runs and import reports.

Previous Next

KOWAL.BLOG

Choose your language

Available versions open the corresponding page. More languages are being prepared.

English (UK) Français Deutsch Español Italiano Português Nederlands Svenska Dansk Norsk Suomi Lietuvių Latviešu Eesti Čeština Slovenčina Magyar Română Български Ελληνικά Slovenščina Hrvatski Polski English (US)