Organize a catalog

Outcome: the Copenhagen Lamp appears in a Lighting category hierarchy and a curated collection in Storefront discovery.

Prerequisites

Use the active product from Create and publish a product. Decide stable slugs and whether the grouping is hierarchical or curated.

1. Create categories

Code in graphql

Create Home with no parentId, then create Lighting with the returned Home ID. Create a Table lamps child if the storefront needs that depth.

2. Create a collection

Code in graphql

Use {"input":{"name":"Desk refresh","slug":"desk-refresh"}}.

3. Associate and order products

Read ProductUpdateInput and update the product with the returned category and collection IDs. When a group contains multiple products, query its current members before calling categoryReorderProducts or collectionReorderProducts; send a complete order based on the current state.

4. Verify

Query Storefront category and collection by their supported identifier in the prepared store context. Then query products with category_id:<id> and collection_id:<id> separately. The product must still satisfy status, publication, price, and availability rules.

See Categories, Collections, and Search query language.