Categories: Sample Use Cases and Flows

This article presents possible use cases and corresponding sample flows that you can support. This can be a helpful jumping off point as you plan your implementation.

Create a category and subcategory

Organize your product catalog by creating categories and subcategories.

To create a category hierarchy:

  1. Call Create Category with the category details. For top-level categories, omit the parentCategory field:

    Copy
  2. Save the category.id from the response.

  3. Call Create Category again to create a subcategory, including the parent category ID in parentCategory.id:

    Copy

Add and arrange products in a category

Add products to a category and specify their display order.

To add and arrange products:

  1. Call Bulk Add Items To Category with the category ID and product references. Use the Wix Stores app ID ("215238eb-22a5-4c36-9e7b-e7c08025e04e") for appId:

    Copy
  2. Call Set Arranged Items with the products in the desired display order.

    Copy
  3. To ensure the products are displayed in the arranged order, call List Items In Category with useCategoryArrangement: true:

    Copy

Move a category to a different parent category

Reorganize your category hierarchy by moving a category to a different parent category.

To move a category to a new parent:

  1. Identify the category you want to move and the ID of the new parent category.

  2. Call Move Category with the category ID in the path and the new parent category ID:

    Copy

    The position field determines where the category appears among its new siblings. Options include FIRST, LAST, or a specific index.

Find all subcategories of a category

Retrieve all subcategories belonging to a parent category in their display order.

To list subcategories:

  1. Call Search Categories with a filter for the parent category ID and sort by parentCategory.index:

    Copy
Did this help?