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
| Argumento | Tipo | Requerido | Regla |
|---|---|---|---|
slug | String! | 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:
| Campo | Tipo | Descripción |
|---|---|---|
id | String! | ID opaco del producto. |
name | String! | Nombre publicado. |
slug | String! | Slug público. |
description | String! | Descripción publicada. |
productType | String! | Tipo de producto devuelto por el catálogo. |
status | String! | Estado publicado. |
imageUrl | String! | Imagen principal. |
price | Decimal! | Precio actual. |
compareAtPrice | Decimal | Precio de comparación, cuando existe. |
isAvailable | Boolean! | Indica si puede venderse actualmente. |
totalInventory | Int! | Inventario total informado por la lectura. |
brand | String! | Marca. |
category | String! | Categoría. |
categoryId | String | ID 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. |
sizeGuide | SizeGuideInfo | Guía de tallas asignada, cuando existe. |
priceTiers | [ProductPriceTier!]! | Precios por cantidad. |
createdAt | DateTime | Fecha de creación disponible en la proyección. |
updatedAt | DateTime | Fecha de actualización disponible en la proyección. |
seller | ProductSellerInfo | Vendedor asociado, cuando existe. |
Tipos anidados
Especificaciones, imágenes y vendedor
| Tipo | Campos |
|---|---|
SpecItem | key: String!, name: String!, value: String! |
ImageItem | url: String!, name: String!, order: Int! |
ProductSellerInfo | id: String!, name: String!, slug: String! |
VariantItem
| Campo | Tipo | Campo | Tipo |
|---|---|---|---|
id | String | sku | String! |
status | String! | price | Decimal! |
compareAtPrice | Decimal | quantity | Int! |
isAvailable | Boolean | requiresShipping | Boolean! |
options | [SpecItem!]! | images | [ImageItem!]! |
BundleItem
| Campo | Tipo | Campo | Tipo |
|---|---|---|---|
productId | String! | variantId | String! |
productName | String! | variantName | String |
sku | String | brand | String |
imageUrl | String | quantity | Int! |
available | Int! | allowBackorders | Boolean! |
requiresShipping | Boolean! |
Guía de tallas
SizeGuideInfo contiene id, name, slug, description, imageUrl, gender, measurementType, unit, notes y rows.
id,name,slug,gender,measurementTypeyunitsonString!.description,imageUrlynotessonString.rowses[SizeGuideRowInfo!]!.SizeGuideRowInfocontienelabel: String!,sizeKey: String!,order: Int!ymeasurements: [SizeGuideMeasurementInfo!]!.SizeGuideMeasurementInfocontienekey: String!,name: String!,min: Decimal,max: Decimal,value: Decimalydescription: String.
ProductPriceTier
| Campo | Tipo |
|---|---|
variantId | String! |
minQuantity | Int! |
maxQuantity | Int |
unitPrice | Decimal! |
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"
}cURL
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:
{
"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ódigo | Causa común |
|---|---|
BAD_USER_INPUT | slug está vacío o supera 200 caracteres. |
NOT_FOUND | El producto no existe o no es visible en la tienda. |
STORE_CONTEXT_REQUIRED | x-Store-Domain no resolvió una tienda. |
Consulta Errores GraphQL antes de usar data.