Saltar al contenido
Guías
Consultas

product

Obtén el detalle completo de un producto visible mediante su slug.

Última actualización:

product recupera la representación detallada de un producto publicado en la tienda resuelta.

Firma

product(slug: String!): ProductDetail!

Argumentos

ArgumentoTipoRequeridoRegla
slugString!SíSe recorta antes de buscar y no puede superar 200 caracteres.

El slug identifica la URL pública del producto; no es su ID opaco.

Retorno

ProductDetail expone:

CampoTipoDescripción
idString!ID opaco del producto.
nameString!Nombre publicado.
slugString!Slug público.
descriptionString!Descripción publicada.
productTypeString!Tipo de producto devuelto por el catálogo.
statusString!Estado publicado.
imageUrlString!Imagen principal.
priceDecimal!Precio actual.
compareAtPriceDecimalPrecio de comparación, cuando existe.
isAvailableBoolean!Indica si puede venderse actualmente.
totalInventoryInt!Inventario total informado por la lectura.
brandString!Marca.
categoryString!Categoría.
categoryIdStringID opaco de categoría, cuando existe.
tags[String!]!Etiquetas publicadas.
specifications[SpecItem!]!Especificaciones del producto.
variants[VariantItem!]!Variantes publicadas.
images[ImageItem!]!Galería del producto.
bundleItems[BundleItem!]!Componentes cuando el producto es un bundle.
sizeGuideSizeGuideInfoGuía de tallas asignada, cuando existe.
priceTiers[ProductPriceTier!]!Precios por cantidad.
createdAtDateTimeFecha de creación disponible en la proyección.
updatedAtDateTimeFecha de actualización disponible en la proyección.
sellerProductSellerInfoVendedor asociado, cuando existe.

Tipos anidados

Especificaciones, imágenes y vendedor

TipoCampos
SpecItemkey: String!, name: String!, value: String!
ImageItemurl: String!, name: String!, order: Int!
ProductSellerInfoid: String!, name: String!, slug: String!

VariantItem

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

BundleItem

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

Guía de tallas

SizeGuideInfo contiene id, name, slug, description, imageUrl, gender, measurementType, unit, notes y rows.

  • id, name, slug, gender, measurementType y unit son String!.
  • description, imageUrl y notes son String.
  • rows es [SizeGuideRowInfo!]!.
  • SizeGuideRowInfo contiene label: String!, sizeKey: String!, order: Int! y measurements: [SizeGuideMeasurementInfo!]!.
  • SizeGuideMeasurementInfo contiene key: String!, name: String!, min: Decimal, max: Decimal, value: Decimal y description: String.

ProductPriceTier

CampoTipo
variantIdString!
minQuantityInt!
maxQuantityInt
unitPriceDecimal!

Query

Product.graphql
query Product($slug: String!) {
  product(slug: $slug) {
    id
    name
    slug
    description
    productType
    status
    imageUrl
    price
    compareAtPrice
    isAvailable
    totalInventory
    brand
    category
    categoryId
    tags
    specifications { key name value }
    variants {
      id
      sku
      status
      price
      compareAtPrice
      quantity
      isAvailable
      requiresShipping
      options { key name value }
      images { url name order }
    }
    images { url name order }
    bundleItems {
      productId
      variantId
      productName
      variantName
      sku
      brand
      imageUrl
      quantity
      available
      allowBackorders
      requiresShipping
    }
    sizeGuide {
      id
      name
      slug
      description
      imageUrl
      gender
      measurementType
      unit
      notes
      rows {
        label
        sizeKey
        order
        measurements { key name min max value description }
      }
    }
    priceTiers { variantId minQuantity maxQuantity unitPrice }
    createdAt
    updatedAt
    seller { id name slug }
  }
}

Variables:

Variables
{
  "slug": "mug"
}

cURL

Terminal
curl --request POST "https://storefront.ecomiq.pe/graphql" \
  --header "Content-Type: application/json" \
  --header "x-Store-Domain: mi-tienda" \
  --data-binary '{
    "query": "query Product($slug: String!) { product(slug: $slug) { id name slug description productType status imageUrl price compareAtPrice isAvailable totalInventory brand category categoryId tags specifications { key name value } variants { id sku status price compareAtPrice quantity isAvailable requiresShipping options { key name value } images { url name order } } images { url name order } bundleItems { productId variantId productName variantName sku brand imageUrl quantity available allowBackorders requiresShipping } sizeGuide { id name slug description imageUrl gender measurementType unit notes rows { label sizeKey order measurements { key name min max value description } } } priceTiers { variantId minQuantity maxQuantity unitPrice } createdAt updatedAt seller { id name slug } } }",
    "variables": { "slug": "mug" }
  }'

Respuesta

Este ejemplo conserva los valores y ausencias cubiertos por el fixture del host:

Respuesta
{
  "data": {
    "product": {
      "id": "456",
      "name": "Mug",
      "slug": "mug",
      "description": "A mug",
      "productType": "Product",
      "status": "Active",
      "imageUrl": "/mug.jpg",
      "price": 10,
      "compareAtPrice": null,
      "isAvailable": true,
      "totalInventory": 3,
      "brand": "Acme",
      "category": "Home",
      "categoryId": null,
      "tags": [],
      "specifications": [],
      "variants": [],
      "images": [],
      "bundleItems": [],
      "sizeGuide": null,
      "priceTiers": [],
      "createdAt": null,
      "updatedAt": null,
      "seller": null
    }
  }
}

Errores

CódigoCausa común
BAD_USER_INPUTslug está vacío o supera 200 caracteres.
NOT_FOUNDEl producto no existe o no es visible en la tienda.
STORE_CONTEXT_REQUIREDx-Store-Domain no resolvió una tienda.

Consulta Errores GraphQL antes de usar data.

Consultas relacionadas

En esta página