OVIRO LogoOVIRO
Quản lý sản phẩm (PIM)Sản phẩm

Variant Object

Cấu trúc đối tượng biến thể sản phẩm (Product Variant).

Mỗi sản phẩm có thể có nhiều biến thể (variants), đại diện cho các phiên bản khác nhau (màu sắc, kích thước, dung lượng...). Variant Object chứa thông tin giá, SKU, ảnh riêng và các thuộc tính vật lý.

Schema

{
  "id": 100,
  "sku": "IP15PM-256-TITAN",
  "display_name": "Iphone 15 Pro Max 256GB Titan",
  "note": "",
  "base_price": 30000000,
  "sell_price": 28000000,
  "compare_price": 32000000,
  "discount_percent": 6,
  "sell_price_for_uoms": [],
  "price_by_uom": [],
  "price_by_policy": [
    {
      "price_policy_id": 1,
      "price": 27000000,
      "price_by_uom": []
    }
  ],
  "display_order": 1,
  "option_values": [
    {
      "option_id": 1,
      "option_value_id": 101
    }
  ],
  "photo_gallery_file_list": [
    {
      "id": 601,
      "url": "https://example.com/variant-image.jpg"
    }
  ],
  "min_stock": 0,
  "is_serial_tracked": 0,
  "length": 0,
  "width": 0,
  "height": 0,
  "weight": 221
}

Field Descriptions

Thông tin chung

TrườngKiểuMô tả
idintegerID biến thể
skustringMã SKU duy nhất
display_namestringTên hiển thị của biến thể
notestringGhi chú
display_orderintegerThứ tự hiển thị

Giá

TrườngKiểuMô tả
base_pricefloatGiá gốc (niêm yết). Luôn >= sell_price
sell_pricefloatGiá bán thực tế (đã áp dụng chính sách giá). ⚠️ Deprecated, sử dụng price_by_policy thay thế
compare_pricefloatGiá so sánh (giá thị trường)
discount_percentintegerPhần trăm giảm giá (tự tính: floor((base_price - sell_price) / base_price * 100))
sell_price_for_uomsarrayGiá bán theo đơn vị tính. ⚠️ Deprecated, sử dụng price_by_policy[].price_by_uom thay thế
price_by_uomarrayBảng giá theo đơn vị tính
price_by_policyarrayBảng giá theo chính sách. Xem Price Policy Schema

Option Values

TrườngKiểuMô tả
option_valuesarrayDanh sách giá trị option mà biến thể này đại diện (option_id, option_value_id)

Media

TrườngKiểuMô tả
photo_gallery_file_listarrayẢnh riêng của biến thể (File Object)

Inventory & Physical

TrườngKiểuMô tả
min_stockintegerTồn kho tối thiểu
is_serial_trackedintegerTheo dõi số serial (1 = Có)
lengthintegerChiều dài
widthintegerChiều rộng
heightintegerChiều cao
weightintegerCân nặng

Price Policy Schema

Mỗi item trong price_by_policy đại diện cho một chính sách giá (Khách VIP, Đại lý...).

{
  "price_policy_id": 1,
  "price": 27000000,
  "price_by_uom": [
    {
      "uom_id": 1,
      "price": 320000000
    }
  ]
}
TrườngKiểuMô tả
price_policy_idintegerID chính sách giá
pricefloatGiá bán theo chính sách
price_by_uomarrayGiá theo đơn vị tính trong chính sách (uom_id, price)

Cách xác định giá hiển thị

Hệ thống xác định giá bán theo thứ tự ưu tiên:

  1. Nếu có website_price_policy_id trong Settings → lấy giá từ price_by_policy tương ứng
  2. Nếu không → lấy base_price
  3. discount_percent được tính tự động: nếu base_price > sell_price, discount_percent = floor((base_price - sell_price) / base_price * 100)

On this page