Skip to content

Get Variant By ID

Get a specific product variant by its ID.

Endpoint

GET /v1/products/variant/store/get-by/?id={variant_id}&product_id={product_id}

Authentication

Required (Store role)

Query Parameters

Parameter Type Required Description
id integer Yes Variant ID
product_id integer Yes Product ID

Response

Success (200 OK)

{
  "id": 1,
  "product_id": 5,
  "product": {
    "id": 5,
    "store_id": 5,
    "store": {...},
    "category_id": 3,
    "category": {...},
    "brand_id": 2,
    "brand": {...},
    "currency_id": 1,
    "currency": {...},
    "created": "2025-01-15T10:30:00Z"
  },
  "name_az": "Məhsul Adı",
  "name_en": "Product Name",
  "name_es": "Nombre del Producto",
  "name_de": "Produktname",
  "description_az": "Məhsul Təsviri",
  "description_en": "Product Description",
  "sku": "SKU-001",
  "stock_quantity": 100,
  "price": 29.99,
  "attributes": [
    {
      "id": 1,
      "attribute_id": 1,
      "attribute_name": "Color",
      "attribute_type": "select",
      "value": "Red",
      "is_filter": true,
      "is_view": true
    }
  ],
  "images": [
    {
      "id": 1,
      "order": 1,
      "image": "https://..."
    }
  ],
  "created": "2025-01-15T10:30:00Z"
}

Error Responses

Product Not Found (404)

{
  "error": "Product not found"
}

Variant Not Found (404)

{
  "error": "Product Variant not found"
}

Example Request

curl -X GET "https://api.luxmart.site/v1/products/variant/store/get-by/?id=1&product_id=5" \
  -H "Authorization: Token your_access_token"

Notes

  • Product must belong to the authenticated store
  • Variant must belong to the specified product
  • Only returns non-deleted variants