Try our conversational search powered by Generative AI!

How do I set primary category?


I'm upgrading from commerce 9, to 11. Something I noticed is that there is a Primary category, which is awesome.

But how do you set this primary category?

Looking at the documentation it looks like you need to go up one level from the image above, and drag it into the tree? Is there no easier way to assign a primary, for a category that already has categories set?


Sep 14, 2017 19:51

Yes, changing the primary category in the UI requires you to move the item. This reflects the idea that the primary category represents where the item "is" (e.g. its home category - a product type or brand) as a contrast to where it is linked (auxiliary categories used to market the product in vairous contexts). It also makes the behavior of entries and categories (that always had a specific primary parent category) better aligned.

Sep 14, 2017 20:19

The SQL upgrade script to Commerce 11 should have set one of your categories to be primary. Perhaps you somehow missed that?

Sep 14, 2017 21:04

Hey Quan, The script ran fine, I have primaries. The problem is more when the script ran, I want to updated the primaries.

In the photo I provided, Acrhomatic Lenses is the primary. Well as a test, I want to set Optical Lenses as a primary. How would I do that?

It sounds like Magnus is saying I should go up one level, then find the category on the try, and move it. I've tested this and it doesn't seem to work. The primary is never updated.


Sep 14, 2017 21:16

Also worth noting, this is a major pain. We used to just use the first item in the sort order as the primary, which seems to work, but updating this now is going to be a nightmare for our content people.

That's if it even worked, which it doesn't. At least for me on Commerce 11.1.1.


Sep 14, 2017 21:18

You should move your item (27653) to Optical Lenses - either by drag and drop or cut and paste and choose Move when the confirmation dialog pops up.

In Commerce 11.2 we introduce the APIs to set the primary category - but we hear you. We will look into this to see if we can make this is easier for editor. No promise yes, but we will keep you posted.

Sep 14, 2017 22:20

ok. Thanks for listening. Please keep this in mind for future releases. I'm closing this ticket.


Sep 14, 2017 22:22

@Quan, we are using 11.5 and had some trouble that the variants ended up under the catalog root when updated them by our custom import. I changed to use the NodeEntryRelation instead of NodeRelation so that the category node is the parent and the variant is child and also I set the relation to IsPrimary.
The relation was updated just fine but the variant was still placed under the catalog root. Looking at the ParentLink it was pointing to the category root and looking at the variant the category link was placed under "Additional categories".

To get the link in "Primary category" and to get the variant in the right place in the tree i had to use the ContentRepository to move it to the correct parent. 
Is this how you are supposed to do it or should it be enough to update the primary NodeEntryRelation?



Edited, Dec 12, 2017 17:16

Updating primary NodeEntryRelation should be enough. Can you check the NodeEntryRelation table to make sure the relation was actually set to primary? An entry is shown under catalog root when it has no primary NodeEntryRelation.

Dec 12, 2017 17:20

You where right, setting the IsPrimary was enough. It was other variations that poped up after moving some of them.


Dec 12, 2017 18:05
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.