Skip to Content
StoreOSv0.27.1
Core GraphQL APIReferenceQueries

Inventory__collection Tree

Returns the collection tree (hierarchy) for the current tenant. Requires a signed-in staff user. Needs the `inventory__Collection` `read` permission. Send the `x-tenant` header (the gateway sets it from your API key).

QUERYinventory__collectionTree(rootCategoryId: ID): [Collection!]!

Returns the collection tree (hierarchy) for the current tenant. Requires a signed-in staff user. Needs the inventory__Collection read permission. Send the x-tenant header (the gateway sets it from your API key).

Arguments

rootCategoryId?ID

Returns

  1. inventory__collectionTree
_id*ID!
children?

Child subcollections (populated via virtual)

commits?
createdAt?DateTime

A date-time string at UTC, such as 2019-12-03T09:54:33Z, compliant with the date-time format.

description?String
isDemo?Boolean
level?Int

Depth level in the hierarchy

logo?
name?String
parentCategory?ID

Parent collection ID for subcollection hierarchy

slug?String

URL handle used in storefront links (/collections/{slug})

sortOrder?Int

Position among sibling collections (ascending). Ties sort by name.

tenant?String
updatedAt?DateTime

A date-time string at UTC, such as 2019-12-03T09:54:33Z, compliant with the date-time format.

Example Request
query Inventory__collectionTree {  inventory__collectionTree {    _id    children {      _id      children {        _id        createdAt        description        isDemo        level        name        parentCategory        slug      }      commits {        action        committedAt        note      }      createdAt      description      isDemo      level      name      parentCategory      slug    }    commits {      action      commitedBy {        email        name        phoneNumber        referenceId      }      committedAt      note    }    createdAt    description    isDemo    level    name    parentCategory    slug  }}
Example Response
{  "data": {    "inventory__collectionTree": [      {        "_id": "1",        "children": [          {            "_id": "1",            "children": [              {                "_id": "1",                "createdAt": "<DateTime>",                "description": "string",                "isDemo": true,                "level": 10,                "name": "string",                "parentCategory": "1",                "slug": "string"              }            ],            "commits": [              {                "action": "string",                "committedAt": "<DateTime>",                "note": "string"              }            ],            "createdAt": "<DateTime>",            "description": "string",            "isDemo": true,            "level": 10,            "name": "string",            "parentCategory": "1",            "slug": "string"          }        ],        "commits": [          {            "action": "string",            "commitedBy": {              "email": "string",              "name": "string",              "phoneNumber": "string",              "referenceId": "1"            },            "committedAt": "<DateTime>",            "note": "string"          }        ],        "createdAt": "<DateTime>",        "description": "string",        "isDemo": true,        "level": 10,        "name": "string",        "parentCategory": "1",        "slug": "string"      }    ]  }}