Skip to main content
Published: May 14 2009, 5:08:00 PMUpdated: August 19 2022, 2:25:25 AM

How do I create custom categories for my store? Also how do I go about creating child categories for the root level categories I create?

When not using the SDK, the documentation is a good reference for specifying the proper schema XML or SOAP request. For documentation on custom categories see this link: Store Categories Documentation. The following is a basic walkthrough of setting up custom categories. This is also a potentially helpful workaround to any bugs that prevent child categories from being created when using the 'ChildCategory' fields.

1) Have an idea of what the desired category hierarchy will look like. In this example I'm going to have the following simple hierarchy:

  • CustomCategory1
    • ChildCategory1
  • CustomCategory2

It's always a good idea to keep child categories close to the root level so users don't have to dig very far to find what they are looking for.

2) Now for the actual request that will take care of all the root level categories (CustomCategory1 & 2)

<?xml version="1.0" encoding="utf-8"?>
<SetStoreCategoriesRequest xmlns="urn:ebay:apis:eBLBaseComponents">
<ErrorLanguage>en_US</ErrorLanguage>
<Version>613</Version>
<Action>Add</Action>
<StoreCategories>
<CustomCategory>
<Name>CustomCategory1</Name>
<Order>0</Order>
</CustomCategory>
<CustomCategory>
<Name>CustomCategory2</Name>
<Order>1</Order>
</CustomCategory>
</StoreCategories>
<RequesterCredentials>

</RequesterCredentials>
</SetStoreCategoriesRequest>

I specified the 'Add' action to create the categories; there are a few other available operations like move, delete, etc. I then create separate 'CustomCategory' containers for each root level category and choose the order I want using the 'Order' tag. Notice I didn't specify a DestinationParentCategoryID. Since I want these at the root level, leaving the parent category ID out, the default functionality will place them at root level.

3) Next I need to make a request to GetStore to get the category ID's of all of my newly created categories so I can make sure the child category I'm creating will be inserted properly.

The request looks like:

<?xml version="1.0" encoding="utf-8"?>
<GetStoreRequest xmlns="urn:ebay:apis:eBLBaseComponents">
<Version>613</Version>
<RequesterCredentials>
</RequesterCredentials>
</GetStoreRequest>

4) With all my parent level category ID's written to memory, I can then form my request to insert the child category. The request should look something like:

<?xml version="1.0" encoding="utf-8"?>
<SetStoreCategoriesRequest xmlns="urn:ebay:apis:eBLBaseComponents">
<ErrorLanguage>en_US</ErrorLanguage>
<Version>613</Version>
<Action>Add</Action>
<DestinationParentCategoryID>100188045(CategoryIDFromMemory)</DestinationParentCategoryID>
<StoreCategories>
<CustomCategory>
<Name>ChildCategory1</Name>
</CustomCategory>
</StoreCategories>
<RequesterCredentials>
</RequesterCredentials>
</SetStoreCategoriesRequest>

If everything was successful, there should be two top level categories with the first category having a single sub-category.

How well did this answer your question?
Answers others found helpful

Got thoughts? Click the feedback button – your insights help us improve!