🚀 Usage
This guide explains how to retrieve product category images using the Medusa SDK. The Product Category Images plugin integrates natively with Medusa's existing data fetching mechanisms, so no additional API endpoints are required on the storefront.
1. Retrieve Product Category with Images​
To include product category images when fetching a product category, simply add product_category_images
to the fields
array in your SDK call.
const retrievedCategory = await sdk.store.category.retrieve("prod_cat_...", {
fields: ["id", "name", "product_category_images"],
});
2. List Product Categories with Images​
To include product category images when listing product categories, add product_category_images
to the fields
array in your SDK call.
const = await sdk.store.category.list({
fields: ["id", "name", "product_category_images"],
});