Skip to main content
By default, the Store API returns only the primary resource attributes to keep responses fast and lightweight. Use the expand parameter to expand related resources inline.

Including Relations

Pass a comma-separated list of relation names via the expand query parameter:
// Product with variants and images
const product = await client.store.products.get('spree-tote', {
  expand: ['variants', 'images'],
})

// Access included relations directly
console.log(product.variants)  // Array of variant objects
console.log(product.images)    // Array of image objects

Response Format

Without expand, relation fields are omitted from the response:
{
  "id": "prod_86Rf07xd4z",
  "name": "Spree Tote",
  "slug": "spree-tote",
  "price": { "amount": "15.99", "currency": "USD" },
  "created_at": "2025-01-15T10:30:00Z"
}
With ?expand=variants,images, the related resources are embedded:
{
  "id": "prod_86Rf07xd4z",
  "name": "Spree Tote",
  "slug": "spree-tote",
  "price": { "amount": "15.99", "currency": "USD" },
  "created_at": "2025-01-15T10:30:00Z",
  "variants": [
    {
      "id": "variant_k5nR8xLq",
      "sku": "SPR-TOTE-RED",
      "price": { "amount": "15.99", "currency": "USD" },
      "in_stock": true,
      "option_values": [{ "name": "Red", "option_type_name": "Color" }]
    }
  ],
  "images": [
    {
      "id": "img_9xPq2wLm",
      "url": "https://cdn.example.com/spree-tote.jpg",
      "alt": "Spree Tote"
    }
  ]
}

Available Relations by Resource

Products

RelationDescription
variantsAll purchasable variants
default_variantThe default variant
master_variantThe master variant
imagesAll product images (across all variants)
option_typesOption types (e.g., Size, Color)
taxonsCategories this product belongs to
metafieldsPublic metafields (custom structured data)
const product = await client.store.products.get('spree-tote', {
  expand: ['variants', 'images', 'option_types', 'metafields'],
})

Taxons (Categories)

RelationDescription
ancestorsParent taxons (for breadcrumbs)
childrenDirect child taxons
productsProducts in this taxon
const taxon = await client.store.taxons.get('categories/clothing', {
  expand: ['ancestors', 'children'],
})

Taxonomies

RelationDescription
rootRoot taxon
taxonsAll taxons in this taxonomy

Countries

RelationDescription
statesStates/provinces within the country
const usa = await client.store.countries.get('US', {
  expand: ['states'],
})
console.log(usa.states) // Array of state objects

Collections with Includes

The expand parameter also works on collection endpoints:
// List products with their images and default variant
const { data: products } = await client.store.products.list({
  expand: ['images', 'default_variant'],
  limit: 12,
})

Nested Includes

Use dot notation to include nested relations:
// Include variants and their nested option values
const product = await client.store.products.get('spree-tote', {
  expand: ['variants.option_values'],
})
Only include relations you actually need. Each included relation requires additional database queries, so requesting unnecessary relations will slow down the response.