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ý.
{
"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
}
Trường Kiểu Mô 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ị
Trường Kiểu Mô 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
Trường Kiểu Mô tả option_valuesarrayDanh sách giá trị option mà biến thể này đại diện (option_id, option_value_id)
Trường Kiểu Mô tả photo_gallery_file_listarrayẢnh riêng của biến thể (File Object)
Trường Kiểu Mô 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
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ường Kiểu Mô 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)
Hệ thống xác định giá bán theo thứ tự ưu tiên:
Nếu có website_price_policy_id trong Settings → lấy giá từ price_by_policy tương ứng
Nếu không → lấy base_price
discount_percent được tính tự động: nếu base_price > sell_price, discount_percent = floor((base_price - sell_price) / base_price * 100)