Variantes
Las variantes de producto te permiten agrupar un mismo zapato con diferentes tallas y colores.
Propiedades
| Propiedad | Explicación |
|---|---|
| id | Identificador numérico único de la variante |
| promotional_price | Precio promocional de la variante, si tiene un descuento aplicado |
| created_at | Fecha y hora en que se creó la variante |
| values | Lista de valores que definen la variante (por ejemplo: talla, color, etc.) |
| price | Precio base de la variante |
| product_id | Identificador del producto al que pertenece la variante |
| published | Indica si la variante está visible (true) u oculta (false) |
| stock_management | Indica si el stock es ilimitado; si es true, la variante tiene stock infinito |
| stock | Cantidad disponible en inventario para la variante |
| sku | Código único de identificación (Stock Keeping Unit) de la variante |
| updated_at | Fecha y hora de la última actualización de la variante |
| image_id | ID de la imagen asociada a la variante. null si no tiene imagen asignada. |
| dimensions | Dimensiones físicas de la variante (alto, ancho, largo, peso, etc.) |
Endpoints
GET /products/{product_id}/variants
Recibir todas las variantes de un producto
| Parámetro | Explicación |
|---|---|
| product_id | Id del producto para ver las variantes |
| page | Página a mostrar |
| per_page | Cantidad de resultados |
Cuando el producto no tiene variantes, la respuesta devuelve results vacío.
Las variantes ocultas se incluyen en la respuesta con published: false.
GET /products/5/variants
HTTP/1.1 200 OK
{
"pagination": {
"total": 0,
"page": 1,
"per_page": 50,
"next_page": null
},
"results": []
}
Producto con variantes:
GET /products/2/variants
HTTP/1.1 200 OK
{
"pagination": {
"total": 120,
"page": 1,
"per_page": 50,
"next_page": "https://developers.tiendanegocio.com/v1/products/2/variants?page=2&per_page=50"
},
"results": [
{
"id": 2,
"promotional_price": 150,
"created_at": "2026-03-20T15:43:01.039Z",
"values": [
{
"es": "S"
},
{
"es": "Negro"
}
],
"price": "200",
"product_id": 2,
"published": true,
"stock_management": false,
"stock": 15,
"sku": "car",
"updated_at": "2026-03-20T15:43:01.040Z",
"image_id": 15,
"dimensions": {
"weight": 8,
"depth": 5,
"width": 4,
"height": 1
}
}
]
}
GET /variants/{id}
Recibir una variante en específico
GET /variants/2
HTTP/1.1 200 OK
[
{
"id": 2,
"promotional_price": 150,
"created_at": "2026-03-20T15:43:01.039Z",
"values": [
{
"es": "S"
},
{
"es": "Negro"
}
],
"price": "200",
"product_id": 2,
"published": true,
"stock_management": false,
"stock": null,
"sku": "car",
"updated_at": "2026-03-20T15:43:01.040Z",
"image_id": null,
"dimensions": {
"weight": null,
"depth": null,
"width": null,
"height": null
}
}
]
PUT /variants/{id}
Modificar una variante existente.
| Campo | Explicación |
|---|---|
| price | Precio base de la variante |
| promotional_price | Precio promocional de la variante |
| stock_management | Si es true, la variante tiene stock ilimitado |
| stock | Cantidad disponible en inventario |
| sku | Código SKU de la variante |
| weight | Peso de la variante |
| width | Ancho de la variante |
| height | Alto de la variante |
| depth | Profundidad de la variante |
| status | Visibilidad de la variante (true = visible, false = oculta) |
| image_id | ID de imagen del producto. Debe pertenecer al mismo product_id de la variante. Enviar null para quitar la imagen |
PUT /variants/298
{
"price": "15000",
"promotional_price": "12000",
"stock_management": false,
"stock": 10,
"sku": "SKU-123",
"weight": 1.2,
"width": 20,
"height": 10,
"depth": 5,
"status": true,
"image_id": 42
}
Respuesta
HTTP/1.1 200 OK
{
"id": 298,
"promotional_price": "12000",
"created_at": "2026-04-10T18:10:20.787Z",
"values": [
{
"es": "Blue"
}
],
"price": "15000",
"product_id": 463,
"stock_management": true,
"stock": 10,
"sku": "SKU-123",
"updated_at": "2026-04-10T18:10:20.787Z",
"image_id": 42,
"cost": null,
"dimensions": {
"weight": 1.2,
"depth": 5,
"width": 20,
"height": 10
}
}
Errores
HTTP/1.1 400 Bad Request — la imagen pertenece a otro producto:
{
"statusCode": 400,
"message": "Image with ID 42 belongs to product 100, but variant 298 belongs to product 463. The image must belong to the same product as the variant.",
"error": "Bad Request"
}
HTTP/1.1 400 Bad Request — la imagen no existe o no es válida para el producto:
{
"statusCode": 400,
"message": "Image with ID 42 was not found or is not a valid product image for product 463.",
"error": "Bad Request"
}
DELETE /variants/{id}
Oculta una variante (soft delete). La variante se marca como oculta