0

Basically i am adding a custom category the problem is when i add two child category with same NAME in to one parent category where child category is already present then this shows error of URL KEY.

My code is

$category->setPath($parentCategory->getPath())
            ->setParentId($parentId)
            ->setName('test1')
            ->setIsActive(true);
        $category->save();

Is it possible to add two categories with same NAME in one parent category? thanks in advance

0

Yes you can add Same category name but please make sure URL key should be different or else Magento will not allow you to add same category name.

  • how can i change that URL? – Asad Ullah Mar 22 at 16:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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