Skip to content

MassAssignCategory — Mass Category Assignment

Extension for Magento 2

User Guide


CopeX GmbH
Web: https://copex.io
Email: office@copex.io


Table of Contents

Section Page
1 Requirements 2
2 Installation 2
3 Configuration 2
4 Usage 3
5 Troubleshooting 5

1 Requirements

  • Magento 2.4 or higher
  • PHP 8.1 or higher
  • Admin access rights to the product catalog

2 Installation

Via Composer

composer require copex/module-massassigncategory
php bin/magento module:enable CopeX_MassAssignCategory
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
php bin/magento cache:flush

3 Configuration

The module configuration is located in the Magento 2 admin panel under Stores > Configuration > Catalog > Catalog > Mass assign categories.

Configuration

3.1 Category Tree Depth

  • Depth level — Sets the maximum depth of the displayed category tree. A higher value makes deeper category levels visible in the tree. Default value: 3.

Example: With a value of 3, categories up to the third level are shown: - Level 1: Clothing - Level 2: Men, Women, Children - Level 3: Shirts, Trousers, Jackets, ...


4 Usage

4.1 Selecting Products for Mass Assignment

  1. Navigate to Catalog > Products.
  2. Use filters if needed to narrow down the desired products.
  3. Select the products whose categories you want to change by checking the boxes in the first column.

  4. In the Actions dropdown, click Update Attributes.

4.2 Adding Categories

On the "Update Attributes" page, you'll find the Categories tab.

In the Add Categories area, the category tree is shown as a nested checkbox list.

  1. Check the boxes for the categories you want to add to the selected products.
  2. Multiple categories can be selected at the same time.
  3. Click Save (or scroll down and click the button at the bottom of the page).

Note: Adding categories is additive. Existing category assignments on the products remain unchanged.

4.3 Removing Categories

The Remove Categories area also shows the category tree.

  1. Check the boxes for the categories you want to remove from the selected products.
  2. Click Save.

Note: Only the selected categories are removed. Other category assignments on the products remain unchanged.

4.4 Adding and Removing Simultaneously

Categories can be added and removed in a single save operation. Select the desired categories in the "Add Categories" area and the categories to remove in the "Remove Categories" area, then click Save.

4.5 Feedback After Saving

After a successful save, a success message shows the number of updated products. If errors occur (e.g. invalid category IDs), a corresponding error message is displayed.


5 Troubleshooting

  • Categories tab does not appear on the attribute update page — Make sure the module is enabled and the cache has been flushed. Also check that static files have been redeployed (php bin/magento setup:static-content:deploy).

  • Category tree is empty — The module loads categories based on the root categories configured in the store. Make sure at least one root category and subcategories exist in the system.

  • Too many category levels make the form confusing — Reduce the Depth level in the configuration (Stores > Configuration > Catalog > Catalog > Mass assign categories > Depth level).

  • Changes are not taking effect — After saving, the Magento index must be rebuilt. Run php bin/magento indexer:reindex or navigate to System > Index Management and perform the reindex.

  • "Category not found" error message — This can occur with disabled flat categories. Make sure the Magento configuration for flat categories is correctly set up.


License

GPL-3.0 Open Source — CopeX GmbH.