We need to change the category ids on our store.

For example, our category of "automotive" was assigned a category ID of 129 and we would like that category to have the ID 268.

What is the best way to go about this and are there any risks associated?

  • One of the biggest flaws in dealing with a database system is allowing users to assign to or assume that a key has any sort of relevance beyond being a key. Keys are merely a unique identifier that ties multiple table relationships together. Changing them is a whim that will have unintended consequences up to and including total database corruption. Commented Jan 26, 2016 at 21:26

1 Answer 1


If you want to do this then there will be lots of issues.

The category main table is catalog_category_entity. You need to change the category id in its primary key field entity_id.

There are multiple tables that reference this key:

  • the category and product relation table catalog_category_product
  • the catalog price rules table
  • the EAV value tables:

    • catalog_category_entity_datetime

    • catalog_category_entity_decimal

    • catalog_category_entity_int

    • catalog_category_entity_text

    • catalog_category_entity_varchar

You can try it, on your risk. But please take a backup first!

  • Thanks. Another solution for us would be to recreate the categories with the correct ID, any idea how we can accomplish that?
    – Haim
    Commented Jun 15, 2015 at 20:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.