diff --git a/docs/content/modules/products/overview.mdx b/docs/content/modules/products/overview.mdx index e7b98b759d..e156478cb8 100644 --- a/docs/content/modules/products/overview.mdx +++ b/docs/content/modules/products/overview.mdx @@ -34,7 +34,7 @@ Admins can manage unlimited amount of products and their variants. They can mana { type: 'link', href: '/user-guide/products/manage', - label: 'User Guide: Manage Products', + label: 'User Guide: Products', customProps: { icon: Icons['users-solid'], description: 'Manage products in Medusa Admin.' @@ -66,13 +66,12 @@ Customers can use this organization to filter products while browsing them. customProps: { icon: Icons['academic-cap-solid'], description: 'Learn how to manage categories using Admin APIs.', - isSoon: true, } }, { type: 'link', href: '/user-guide/products/categories', - label: 'User Guide: Manage Categories', + label: 'User Guide: Categories', customProps: { icon: Icons['users-solid'], description: 'Learn how to manage categories in the Medusa Admin.' diff --git a/docs/content/modules/products/store/use-categories.mdx b/docs/content/modules/products/store/use-categories.mdx index c324fab099..9991c96e6e 100644 --- a/docs/content/modules/products/store/use-categories.mdx +++ b/docs/content/modules/products/store/use-categories.mdx @@ -49,6 +49,9 @@ If you follow the Medusa React code blocks, it's assumed you already have [Medus You can list product categories by sending a request to the [List Product Categories endpoint](/api/store#tag/Product-Category/operation/GetProductCategories): + + + ```ts medusa.productCategories.list() .then(({ product_categories, limit, offset, count }) => { @@ -56,6 +59,9 @@ medusa.productCategories.list() }) ``` + + + ```tsx import { useProductCategories } from "medusa-react" import { ProductCategory } from "@medusajs/medusa" @@ -88,8 +94,11 @@ function Categories() { export default Categories ``` + + + ```ts -fetch(`/product-categories`, { +fetch(`/store/product-categories`, { credentials: "include", }) .then((response) => response.json()) @@ -98,11 +107,17 @@ fetch(`/product-categories`, { }) ``` + + + ```bash curl -L -X GET '/store/product-categories' \ -H 'Authorization: Bearer ' ``` + + + This request does not require any query parameters. You can, however, pass query parameters to filter the list of categories, such as the passing the `q` query parameter to search categories by title or handle. You can learn about available query parameters in the [API reference](/api/store#tag/Product-Category/operation/GetProductCategories). The request returns an array of product categories along with [pagination fields](/api/store#section/Pagination). @@ -117,6 +132,9 @@ By default, the categories are not retrieved along with their nested children. T You can retrieve a single product category by using the [Get a Product Category endpoint](/api/store#tag/Product-Category/operation/GetProductCategoriesCategory): + + + ```ts medusa.productCategories.retrieve(productCategoryId) .then(({ product_category }) => { @@ -124,6 +142,9 @@ medusa.productCategories.retrieve(productCategoryId) }) ``` + + + ```tsx import { useProductCategory } from "medusa-react" @@ -141,8 +162,13 @@ function Category() { export default Category ``` + + + + + ```ts -fetch(`/product-categories/${productCategoryId}`, { +fetch(`/store/product-categories/${productCategoryId}`, { credentials: "include", }) .then((response) => response.json()) @@ -151,11 +177,17 @@ fetch(`/product-categories/${productCategoryId}`, { }) ``` + + + ```bash curl -L -X GET '/store/product-categories/' \ -H 'Authorization: Bearer ' ``` + + + This request requires the product category ID as a path parameter. You can also pass query parameters such as `expand` and `fields` as explained in the [API reference](/api/store#tag/Product-Category/operation/GetProductCategoriesCategory). The request returns the category as an object. @@ -164,4 +196,4 @@ The request returns the category as an object. ## See Also -- [How to manage product categories](../admin/manage-categories.mdx). +- [How to manage product categories](../admin/manage-categories.mdx). \ No newline at end of file