Issue adding category from code with same segment name


In my project there are two sites and each uses its own catalog. Category with same name can be in both catalog. When I am trying to add Category with IContentRepository it is giving me exception that Category with same Url name already exists. I found that there is flag named 
 episerver:commerce.UseLessStrictEntryUriSegmentValidation" that I can turn on in App.Settings, but I am getting same exception. Am I doing something wrong? 



Oct 17, 2019 0:00

Hi, while reading this blog post, I realize that this validation only happens on publishing and as you are adding that via code that may not work.

Oct 17, 2019 10:29

That setting affects at code level, but as the name might suggest, it only affects the entries, not the categories. I will look into that to see if we can lift the restriction, but that'll take time.

Oct 17, 2019 10:35

When I looked more into this, we have allowed this since Commerce 10.4, for example in Quicksilver I can do this

Note that both categories have mens-shoes as uri segment.

Oct 24, 2019 14:38

Perhaps that you have custom implementation of HierarchicalCatalogPartialRouter ? 

Oct 24, 2019 14:57

For future visitors, there was a bugfix in 13.29 (COM-10258) which allows you to have two categories in two different parent categories with same uri-segment

Edited, Aug 26, 2022 13:39
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.