Skip to content
Queries

product

A published product's details by slug, with variants, related products and a review summary.

product returns the details of a published product from the slug in its URL.

product(slug: String!): ProductDetail!

Arguments

ArgumentTypeRule
slugString!Up to 200 characters. Surrounding spaces are trimmed.

ProductDetail

FieldTypeDescription
idString!Product ID.
nameString!Name.
slugString!Slug.
urlString!The product's public path in the store.
descriptionString!Description.
productTypeString!Product type.
statusString!Status.
imageUrlString!Main image.
priceDecimal!Current price.
compareAtPriceDecimalPrice before the discount.
isAvailableBoolean!true when it can be purchased.
totalInventoryInt!Total stock.
brandString!Brand.
categoryString!Category.
categoryIdStringCategory ID.
tags[String!]!Tags.
specifications[SpecItem!]!Specifications.
variants[VariantItem!]!Variants.
images[ImageItem!]!Gallery.
bundleItems[BundleItem!]!Components, when it's a bundle.
sizeGuideSizeGuideInfoAssigned size guide.
priceTiers[ProductPriceTier!]!Quantity pricing.
createdAtDateTimeCreation date.
updatedAtDateTimeLast update date.
sellerProductSellerInfoSeller, in a marketplace.
related(limit: Int! = 8)[ProductSummary!]!Related products; limit from 1 to 12. Same result as relatedProducts.
reviewSummaryProductReviewSummary!averageRating: Float and reviewCount: Int! of approved reviews.

Nested types

TypeFields
SpecItemkey: String!, name: String!, value: String!, valueId: String, valueName: String, type: String!, color: String, imageUrl: String, unit: String
ImageItemurl: String!, name: String!, order: Int!, type: String!
ProductSellerInfoid: String!, name: String!, slug: String!
ProductPriceTiervariantId: String!, minQuantity: Int!, maxQuantity: Int, unitPrice: Decimal!

VariantItem

FieldTypeFieldType
idStringskuString!
statusString!priceDecimal!
compareAtPriceDecimalquantityInt!
isAvailableBooleanrequiresShippingBoolean!
options[SpecItem!]!images[ImageItem!]!

BundleItem

FieldTypeFieldType
productIdString!variantIdString!
productNameString!variantNameString
skuStringbrandString
imageUrlStringquantityInt!
availableInt!allowBackordersBoolean!
requiresShippingBoolean!

Size guide

TypeFields
SizeGuideInfoid: String!, name: String!, slug: String!, description: String, imageUrl: String, gender: String!, measurementType: String!, unit: String!, notes: String, rows: [SizeGuideRowInfo!]!
SizeGuideRowInfolabel: String!, sizeKey: String!, order: Int!, measurements: [SizeGuideMeasurementInfo!]!
SizeGuideMeasurementInfokey: String!, name: String!, min: Decimal, max: Decimal, value: Decimal, description: String

Example

Product.graphql
query Product($slug: String!) {
  product(slug: $slug) {
    id
    name
    slug
    description
    price
    compareAtPrice
    isAvailable
    brand
    category
    specifications { key name value }
    variants {
      id
      sku
      price
      compareAtPrice
      quantity
      isAvailable
      options { key name value }
      images { url name order }
    }
    images { url name order }
    sizeGuide {
      name
      unit
      rows {
        label
        measurements { name min max value }
      }
    }
    priceTiers { variantId minQuantity maxQuantity unitPrice }
    seller { id name slug }
    reviewSummary { averageRating reviewCount }
    related(limit: 4) { id name slug imageUrl price }
  }
}
Terminal
curl --request POST "https://storefront.ecomiq.pe/graphql" \
  --header "Content-Type: application/json" \
  --header "x-Store-Domain: my-store" \
  --data-binary '{
    "query": "query Product($slug: String!) { product(slug: $slug) { id name slug description price compareAtPrice isAvailable brand category specifications { key name value } variants { id sku price compareAtPrice quantity isAvailable options { key name value } images { url name order } } images { url name order } sizeGuide { name unit rows { label measurements { name min max value } } } priceTiers { variantId minQuantity maxQuantity unitPrice } seller { id name slug } reviewSummary { averageRating reviewCount } related(limit: 4) { id name slug imageUrl price } } }",
    "variables": { "slug": "mug" }
  }'
Response
{
  "data": {
    "product": {
      "id": "456",
      "name": "Mug",
      "slug": "mug",
      "description": "350 ml ceramic mug.",
      "price": 10,
      "compareAtPrice": null,
      "isAvailable": true,
      "brand": "Acme",
      "category": "Home",
      "specifications": [],
      "variants": [],
      "images": [],
      "sizeGuide": null,
      "priceTiers": [],
      "seller": null,
      "reviewSummary": { "averageRating": 4.5, "reviewCount": 12 },
      "related": [
        { "id": "789", "name": "Large mug", "slug": "large-mug", "imageUrl": "/large-mug.jpg", "price": 12 }
      ]
    }
  }
}

Errors

CodeCause
BAD_USER_INPUTslug is empty or longer than 200 characters.
NOT_FOUNDThe product doesn't exist in the store or isn't published.
STORE_CONTEXT_REQUIREDx-Store-Domain is missing or doesn't match a store.

REST equivalent

GET /v1/products/{slug} returns the same product.

Last updated:

On this page