@plentymarkets/shop-api / getCategoryTree
Function: getCategoryTree() ​
getCategoryTree(
context
):Promise
<Data
<CategoryTreeItem
[]>>
getCategoryTree - method for retriving the list with the categories and subcategories ready to be consumed by tree navigation
Parameters ​
• context: PlentysystemsIntegrationContext
Returns ​
Promise
<Data
<CategoryTreeItem
[]>>
Remarks ​
calls /rest/storefront/categories and returns a list of CategoryTreeItems, subcategories are set in children prop.
Example ​
ts
const { data, error } = await useAsyncData(() => sdk.plentysystems.getCategoryTree());
## Defined in
[api/getCategoryTree/index.ts:16](https://github.com/plentymarkets/plentymarkets-sdk/blob/7681f9fc1b75a8a5dd19ff32d7cff3773b5d6c20/packages/api-client/src/api/getCategoryTree/index.ts#L16)