I just realized that I incorrectly named a sub category and its url on a Magento 2.2.7 site. This category currently has approximately 150 products in it. Can I just simply edit the Category Name or will that affect the existing products under that category?


2 Answers 2


not affect anywhere you can just edit category name or change url and run below command

php bin/magento indexer:reindex

-> if you change category name using the code please use below code. if you change category name using this code not affect in the existing product. And yes store id requires in below code so don't forget to set store id.

require __DIR__ . '/app/bootstrap.php';
// require __DIR__ . '../../csv/Customer.php';

$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();
$category = $objectManager->get('\Magento\Catalog\Model\Category')->load(3);
$d["entity_id"] = "3";
$d["is_active"] = "1";

$d["name"] = "TESTA-2_ENG";

// $d["url_key"] = "testa-1-eng";
$d["store_id"] = "0";
$categoryFactory = $objectManager->get('\Magento\Catalog\Api\CategoryRepositoryInterface')->save($category);

After changing category name you need to reindex require.

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.