Mistakes happen — especially when you’re new to Magento. One wrong click, and suddenly an entire product category is gone. The products are still there, but now you’re getting 404 errors, subcategories aren’t accessible, and your site navigation is broken. Sound familiar?
If you’ve accidentally deleted a product category in Magento 2, don’t panic. This guide will walk you through how to recover and reassign your products, rebuild your category structure, and fix those frustrating 404 errors — step by step.
What Actually Happens When You Delete a Product Category?
When a product category is deleted in Magento 2:
- It disappears from the frontend and backend category tree.
- Any subcategories become orphaned or inaccessible.
- The URL paths for the deleted categories break, resulting in 404 errors.
- Products linked only to that category may become harder to find via navigation.

The good news? Your products aren’t deleted — they’re just no longer linked to a category. And with the right steps, you can restore your site’s structure and fix the navigation.
Step 1: Recreate the Deleted Category
Start by manually creating a new product category to replace the one you deleted.
How to:
- Go to Catalog > Categories in your Magento admin.
- Click Add Root Category or Add Subcategory (depending on where it was before).
- Give it the same name as the old one (if possible).
- Set it to “Is Active = Yes” and make sure it’s included in the menu.
- Save the category.
If you can’t reuse the exact URL key (e.g., /buy-shirts) because it’s taken, we’ll address that in a later step.
Step 2: Reassign Products to the New Category
You now need to re-link the products that were in the deleted category to the newly created one.
Option 1: Manual Reassignment (Good for Small Product Sets)
- Go to Catalog > Products.
- Edit each product that was in the deleted category.
- Scroll to the Categories section.
- Tick the checkbox next to your new category.
- Save.
Option 2: Mass Action (Faster for Larger Catalogs)
- In Catalog > Products, filter the products by SKU, attribute set, or name (if you know which ones were affected).
- Select all relevant products.
- In the Actions dropdown, choose Update Attributes.
- Go to the Categories section and select your new category.
- Save.
Step 3: Fix Broken URLs and Redirects
If you’re getting 404 errors on your old category URLs, Magento may still have redirects or URL rewrites in place that point to the now-missing category ID.
Here’s how to fix them:
Check Existing Redirects
- Go to Marketing > URL Rewrites.
- Look for any redirects pointing to the deleted category.
- Delete them or update them to point to your new category.
Create Manual Redirects (Optional but Recommended)
- Go to Marketing > URL Rewrites > Add URL Rewrite.
- Choose Custom.
- Set the Request Path to your old category URL (e.g., buy-shirts).
- Set the Target Path to the new category’s path (e.g., catalog/category/view/id/NEW_ID).
- Save.
This helps preserve your SEO value and ensures visitors (and search engines) land on the right page.
Step 4: Double-Check Subcategories and Configurable Products
If your deleted category has subcategories or products with configurations (like size or color), double-check these areas too.
- Recreate subcategories under the new parent category.
- Reassign configurable product children (simple products) to the new categories.
- Validate that all products appear on the frontend as expected.
Step 5: Clear Caches and Reindex
After reassigning categories and updating URLs:
- Go to System > Cache Management and click Flush Magento Cache.
- Run reindexing via CLI or from the System > Index Management panel if needed.
This ensures all your changes are reflected properly across your site.
Extra Tip: Use the Hyvä Theme? Be Careful with Custom Layouts
If you’re using a custom frontend theme like Hyvä, make sure your new category inherits the correct layout and design configuration. In some cases, custom templates may need to be reapplied.

Final Thoughts
Deleting a product category in Magento 2 can feel catastrophic — but it’s fixable. With a few steps, you can recreate the category, reassign your products, restore your URLs, and get your store navigation back on track.
Everyone makes mistakes. What matters is knowing how to recover fast — and learning how to avoid the same issue in the future. And now that you’ve been through this, you’re no longer “as new as they get” when it comes to Magento.