Installation and configuration guide for the Kowal_ExportImportCategories module
This document describes the installation, configuration, and use of the Kowal_ExportImportCategories module for Magento 2. The guide includes information from the README.md file and the features implemented in the module.
Requirements
- Magento 2.
- PHP compatible with the Magento installation, PHP
8.1 or newer recommended. - Access to Magento CLI.
- Access to Composer.
- Magento administrator permissions.
- Access to the module repository.
- For image import: the ability to place files in the
pub/media/import/categories directory.
Installation via Composer
The module is available through a Composer repository.
1. Add the Composer repository
composer config repositories.export.import.categories vcs https://github.com/kowalco/export-import-categories
2. Add an access token for the private GitHub repository
If the repository is private, configure a GitHub token:
composer config --global --auth github-oauth.github.com
Replace with your own access token.
3. Install the module
composer require kowal/module-export-import-categories
4. Enable the module in Magento
bin/magento module:enable Kowal_ExportImportCategories
5. Run the Magento upgrade
bin/magento setup:upgrade
6. Flush the cache
bin/magento cache:flush
7. Optionally run DI compilation
On production environments or in production mode:
bin/magento setup:di:compile
8. Optionally deploy static assets
If the environment requires it:
bin/magento setup:static-content:deploybin/magento cache:flush
Manual installation in app/code
Alternatively, you can place the module manually in the directory:
app/code/Kowal/ExportImportCategories
After copying the files, run:
bin/magento module:enable Kowal_ExportImportCategoriesbin/magento setup:upgradebin/magento cache:flush
In production mode, also run:
bin/magento setup:di:compile
Verifying the installation
After installation, check whether the module is active:
bin/magento module:status Kowal_ExportImportCategories
The module should appear on the list of active modules.
In the admin panel, go to:
System > Data Transfer > Export/Import Categories
You should see three items:
Export Categories,Import Categories,Import History.
ACL permissions
The module adds separate admin permissions:
- access to the main
Export/Import Categories section, - category export,
- category import,
- import history.
If an admin user does not see the module menu, check the user role in:
System > Permissions > User Roles
Then grant the appropriate permissions for the module resources.
Module location in the panel
The module is available at:
System > Data Transfer > Export/Import Categories
Views:
Export Categories - export categories to CSV.Import Categories - import categories from CSV.Import History - import history and reports.
Export configuration
The export view lets you generate a CSV file with categories.
Export fields
Store View
Selects the store view from which category attribute values will be read.
If you select a language store view, the export may include values specific to that store view or values inherited from the default scope, depending on the value mode.
Start Category ID
An optional field that lets you limit the export to a selected category and its subtree.
If the field is left empty, the module exports categories from the root category of the selected store view.
Store View Value Mode
Defines how store view-dependent values are exported.
Available options:
resolved_value,store_override_only.
resolved_value exports the value visible in the selected store view after applying Magento fallback.
store_override_only exports only the value overridden for the selected store view. If the value is inherited from the default scope, the CSV cell will be empty.
CSV Delimiter
CSV delimiter. Default:
,
You can use a different delimiter if the file will be edited in a tool that requires, for example, a semicolon.
Attributes
List of category attributes available in Magento.
The module loads attributes dynamically from EAV, so the list may also include custom category attributes added in the project.
System columns are added automatically and do not need to be selected.
System columns in export
Export should always include system columns:
store_view_code,entity_id,parent_entity_id,category_path,parent_path,level,position,attribute_set_id.
These columns are used to identify categories, validate the store view, and handle the tree structure.
Import configuration
The import view lets you load a CSV and save category data.
Import fields
Store View
Selects the store view to which values will be saved.
This field determines the numeric store_id used when saving data in Magento tables.
The store_view_code column from the CSV is not directly converted to store_id. It is used to validate whether the file matches the selected store view.
Example:
- in the form, you select a store view with
store_id = 1, - the CSV must contain the
store_view_code corresponding to that store view, - the module saves data using
store_id = 1.
Import Mode
Available modes:
update updates existing categories.
insert creates new categories.
CSV File
CSV file with headers in the first row.
The file should be encoded in UTF-8.
CSV Delimiter
CSV delimiter. It must match the delimiter used in the file.
Unknown Columns Policy
Defines behavior for columns that are neither system columns nor known category attributes.
Available options:
error - import reports an error for unknown columns.ignore - unknown columns are ignored.
Recommended option:
error
Empty Values Policy
Defines how the module interprets empty CSV cells.
Available options:
skip_empty,clear_value,use_default.
skip_empty means an empty cell will not change the current value.
clear_value means an empty cell will clear the attribute value.
use_default means an empty cell will remove the store view override and let Magento use the default value.
Recommended option for update imports:
skip_empty
URL Key Strategy
Defines how the url_key attribute is handled.
Available options:
use_csv_value,generate_from_name,keep_existing,magento_default.
use_csv_value saves url_key from the CSV.
generate_from_name generates url_key based on the name value.
keep_existing keeps the existing url_key in update mode.
magento_default leaves URL handling to the standard Magento mechanism.
Create permanent redirect for URL key changes
This option defines whether Magento should create a permanent redirect when url_key changes.
It is worth enabling when a category URL change should preserve SEO redirects from old addresses.
Images Base Directory
Base directory for category image import relative to pub/media.
Default:
import/categories
Full path in Magento:
pub/media/import/categories
If you provide the following in the CSV:
gear/bags.jpg
the module will look for the file at:
pub/media/import/categories/gear/bags.jpg
Error Policy
Defines import behavior when errors occur.
Available options:
skip_invalid_rows,stop_on_first_error,all_or_nothing.
skip_invalid_rows skips invalid rows and continues the import.
stop_on_first_error stops the import after the first error.
all_or_nothing requires the entire file to be valid; if an error occurs, the import should not save data.
Recommended option for large files:
skip_invalid_rows
Batch Size
Number of rows processed in a single batch.
Default:
100
A lower value reduces memory usage. A higher value may speed up import on stronger environments.
Attributes to Import
List of attributes to be imported.
Import updates only the selected attributes. If a column exists in the CSV but the attribute is not selected in the form, the module should not save it.
Dry Run
Validation mode without saving data.
It is recommended to run dry-run before the actual import, especially for large files or SEO changes.
Import/update mode
update mode is used to update existing categories.
Required data
The CSV must contain:
store_view_code,entity_id or category_path,- at least one selected attribute column.
How category identification works
The module tries to find the category by:
entity_id,category_path, if entity_id is empty.
entity_id is the best identifier when the import is performed in the same Magento environment.
category_path is more portable between environments, but it must be unique.
Translation update example
store_view_code,entity_id,category_path,name,url_key,meta_title,meta_descriptionpl,13,Default Category/Gear/Bags,Torby,torby,Torby,Torby i akcesoriapl,14,Default Category/Gear/Gloves,Rekawiczki,rekawiczki,Rekawiczki,Rekawiczki sportowe
Import settings:
Store View: Polish store view,Import Mode: update,Attributes to Import: name, url_key, meta_title, meta_description,URL Key Strategy: use_csv_value,Empty Values Policy: skip_empty,- first
Dry Run, then the actual import.
Import/insert mode
insert mode is used to create new categories.
Required data
The CSV must contain:
store_view_code,category_path,parent_entity_id or parent_path,name,- at least one selected attribute column.
entity_id is not required because Magento assigns it automatically.
Category creation example
store_view_code,parent_entity_id,parent_path,category_path,name,url_key,is_active,include_in_menudefault,12,Default Category/Gear,Default Category/Gear/Helmets,Helmets,helmets,1,1default,12,Default Category/Gear,Default Category/Gear/Gloves,Gloves,gloves,1,1
Import settings:
Store View: default store view,Import Mode: insert,Attributes to Import: name, url_key, is_active, include_in_menu,URL Key Strategy: use_csv_value or generate_from_name,Error Policy: skip_invalid_rows,- first
Dry Run.
Working with select and multiselect
The module supports select and multiselect by option labels.
You do not need to provide technical option IDs.
Example:
store_view_code,entity_id,category_path,display_mode,available_sort_by,default_sort_bydefault,13,Default Category/Gear/Bags,Products only,Position|Product Name|Price,Position
For multiselect, multiple values are separated with the delimiter:
|
If the label does not exist or is ambiguous, the import will report an error.
Importing category images
Before importing images, place the files in the directory:
pub/media/import/categories
CSV example:
store_view_code,entity_id,category_path,image,thumbnaildefault,13,Default Category/Gear/Bags,gear/bags.jpg,gear/bags-thumb.jpg
Import settings:
Images Base Directory: import/categories,- selected attributes:
image, thumbnail.
The module will check whether the files exist and have supported extensions.
Import report
After import, the module generates a CSV report.
The report includes:
- row number,
- category identifier,
- status,
- message,
- changed attributes.
Statuses may include:
success,error,skipped_no_change,skipped_existing.
Import history
Import history is available at:
System > Data Transfer > Export/Import Categories > Import History
History includes:
- import date,
- admin user,
- store view,
- import mode,
- file name,
- number of rows,
- number of successes,
- number of errors,
- information about
dry-run, - link to download the report.
Recommended workflow
Safe update import
- Export the current categories.
- Keep the original file as a backup.
- Prepare changes in a copy of the CSV.
- Make sure
store_view_code matches the target store view. - Select
update import. - Select only the attributes you want to change.
- Set
Empty Values Policy to skip_empty. - Run
Dry Run. - Check the report.
- Run the actual import.
- Flush the cache if changes are not visible immediately.
Safe import of new categories
- Prepare a CSV with
category_path, parent_path, or parent_entity_id. - Make sure parents exist or appear earlier in the file.
- Select
insert import. - Select at least
name and other required attributes. - Run
Dry Run. - Fix errors from the report.
- Run the actual import.
Cache and indexes
After importing category changes, it is worth refreshing the Magento cache:
bin/magento cache:clean
If the store requires manual reindexing after larger catalog changes:
bin/magento indexer:reindex
In typical Magento installations, saving categories through standard Magento mechanisms should trigger the appropriate processes associated with the category model, but after large imports it is recommended to check cache and indexes.
Common issues
Import reports a mismatched store_view_code
Check whether the code in the store_view_code column matches the store view selected in the import form.
Import does not change values
Check:
- whether the attribute was selected in
Attributes to Import, - whether the CSV cell is not empty,
- whether
Empty Values Policy is not set to skip_empty, - whether the import was not run as
Dry Run.
Select or multiselect reports an error
Check whether the option label in the CSV exactly matches the option label in Magento for the selected store view.
Image is not imported
Check:
- whether the file exists in
pub/media/import/categories, - whether the path in the CSV is correct,
- whether the file extension is supported,
- whether the image attribute was selected for import.
Insert reports a missing parent
Check parent_entity_id or parent_path. The parent must exist in Magento or appear earlier in the import file.
Uninstalling the module
If the module was installed via Composer:
composer remove kowal/module-export-import-categoriesbin/magento setup:upgradebin/magento cache:flush
Before uninstalling, make sure the import history can be removed. The module creates the table:
kowal_export_import_categories_history