Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.colossal.sh/llms.txt

Use this file to discover all available pages before exploring further.

Simplified hooks

Return SimpleProduct objects with pre-computed prices and images.
NameTypePurpose
useProducts(storeUid, currency)HookFetch all products for a store
useProduct(productUid)HookFetch a single product by UID
fetchProducts(storeUid, currency)MethodServer-side fetch of all products
fetchProduct(productUid)MethodServer-side fetch of a single product
import { useProducts, useProduct } from "@colossal-sh/storefront-sdk";

// All products
const { products, isLoading } = useProducts(storeUid, "USD");

// Single product (currency resolved automatically)
const { product } = useProduct("product-uid-here");

Full data hooks

Return the full StoreProduct shape from the GraphQL API, including all variant, pricing, media, and deliverable data.
NameTypePurpose
useStoreProducts(storeUid)HookFetch all products for a store
useStoreProduct(productUid)HookFetch a single product by UID
fetchStoreProducts(storeUid)MethodServer-side fetch of all products
fetchStoreProduct(productUid)MethodServer-side fetch of a single product
import { useStoreProducts, useStoreProduct } from "@colossal-sh/storefront-sdk";

// All products
const { data } = useStoreProducts(storeUid);
const products = data?.productsByStoreUid ?? [];

// Single product
const { data } = useStoreProduct("product-uid-here");
const product = data?.product;

Types

SimpleProduct

Returned by useProducts, useProduct, fetchProducts, and fetchProduct.
product
SimpleProduct

StoreProduct

Returned by useStoreProducts, useStoreProduct, fetchStoreProducts, and fetchStoreProduct. The full product shape from the GraphQL API.
product
StoreProduct

Next steps

  • Cart. Add products to the cart and manage line items
  • Products concepts. Understand the product data model and pricing