2

Recently, I came to know about sellableItem.ParentCategoryList which return ancestors of sellableItem as string of itemIds seperated by pipeline of (i.e. 9c13df93-c115-34ea-es21-6d4f315591ed|9sg234dd-d456-45fd-e2a1-6d4f312345ed)

But I have observed that it is not returning all ancestors of the item.

For example, I am looking for the parent category list for a highlighted sellableitem as per image. When I debug and check sellableItem.ParentCategoryList value, it shows "Television|4k" (In actual, this is itemIds).

But I want result value like "Departments|Television|4k" i.e. all cancestor categories. How can I achieve this?

enter image description here

0

You'll need to build it recursively. ParentCategriesList will only have direct(level1) parents. The reason you see Televisions in the list is because it's also a direct parent.

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.