Update Price, Promotion, Stock - Cập nhật giá, tồn kho, khuyến mãi

Danh mục trợ giúp

Tin mới

Bắt đầu bán hàng

Quy định và chính sách

Quản lý đơn hàng

Quản lý shop

Quản lý tài chính

Quản lý khiếu nại

Kết nối API

Update Price, Promotion, Stock - Cập nhật giá, tồn kho, khuyến mãi

API cập nhật giá, tồn kho của sản phẩm

Note:

 - Trong thời điểm đang áp dụng khuyến mãi sẽ không được cập nhật giá khuyến mãi

-   Sản phẩm đang áp dụng khuyến mãi nếu thay đổi giá gôc thì sẽ hủy giá khuyến mãi

Truyền vào Array []

Tham số

Mô tả

kiểu dữ liệu

Ví dụ

product_id

Id sản phẩm, bắt buộc

int

 

is_config_variant

sản phẩm được tạo theo cấu hình cơ bản hay thuộc tính
(field này được lấy từ api lấy chi tiết sản phẩm, không được edit)
true: cấu hình theo thuộc tính
false: cấu hình theo cơ bản

boolean

is_config_variant: true

special_price

Giá khuyến mãi 
(Nếu Field này có giá trị thì bắt buộc phải nhập thời gian khuyến mãi)

decimal

special_price: 100000

promotion_start_date

Thời gian băt đầu khuyến mãi

date

 

promotion_end_date

Thời gian kết thúc khuyến mãi

date

 

stock_quantity

tồn kho

int

 

stock_availability

trạng thái còn hàng hết hàng

boolean

 

variants

Danh sách sp con trong sản phẩm cấu hình thuộc tính (isConfigVariant = true)

Array

 

**Attributes:

Tên field

Tên diễn giải

kiểu dữ liệu

Dùng trong Tạo/ Cập nhật

Bắt buộc

Mô tả

attribute_id

Id thuộc tính

int

 

option_id

 

int

Không

Không

 

attribute_code

Mã thuộc tính

text

Không

Không

 

Variant: Sản phẩm con

Tên field

Tên diễn giải

Kiểu dữ liệu

Dùng trong cập nhật/ Tạo

Bắt buộc

Mô tả

variant_attributes

thuộc tính đã chọn của sp con

array


xem table **Attribute

variant_sku

mã sản phẩm con

text

không được trùng trong 1 sản phẩm

variant_price

Giá

decimal

 

variant_special_price

Giá khuyến mãi

decimal

không

Giá khuyến mãi 
(Nếu Field này có giá trị thì bắt buộc phải nhập thời gian khuyến mãi)

variant_quantity

Tồn kho

int

Không

 

variant_promotion_start_date

Ngày bắt đầu khuyến mãi

date

Không

 

variant_promotion_end_date

Ngày kết thức khuyến mãi

date

Không

 

Request cập nhật giá tồn kho theo thuộc tính

Sample Request
curl -X PUT \
  https://open.sendo.vn/api/partner/product/config/variant-price \
  -H 'authorization: bearer your_access_token' \
  -H 'content-type: application/json' \
  -d '[
  {
    "product_id": 16674262,
    "price": 777777,
    "stock_quantity": 3,
    "is_config_variant": true,
    "stock_availability": true,
    "special_price": null,
    "promotion_start_date": null,
    "promotion_end_date": null,
    "variants": [
      {
           "variant_attributes": [
              {
                  "attribute_id": 698,
                  "attribute_code": "mau_sac_elt",
                  "option_id": 12526
              }
        ],
        "variant_sku": "string1",
        "variant_price": 7077777,
        "variant_special_price":91000,
        "variant_quantity": 5,
        "variant_promotion_start_date": "2020-06-04T04:22:12.674Z",
        "variant_promotion_end_date": "2020-06-13T04:22:12.674Z",
      }
    ]
  },
  ............
]'

Request cập nhật giá tồn kho theo cấu hình cơ bản

Sample Request
curl -X PUT \
  https://open.sendo.vn/api/partner/product/config/variant-price \
  -H 'authorization: bearer your_access_token' \
  -H 'content-type: application/json' \
  -d '[
  		{
    		"product_id": 16674262,
   			"price": 777777,
    		"stock_quantity": 3,
    		"is_config_variant": false,
    		"stock_availability": true,
    		"special_price": 10000,
    		"promotion_start_date": "2020-06-04T04:22:12.674Z",
    		"promotion_end_date": "2020-06-13T04:22:12.674Z",
    		"variants": []
  },
  ...........
]'

 Response

{
  "result": {
    "success_list": [
      {
        "product_id": 0,
        "message": "string",
        "is_config_variant": true,
        "variants": []
      }
    ],
   "error_list": [
      {
        "product_id": 0,
        "message": "string",
        "is_config_variant": false,
        "variants": [
          {
            "variant_attributes": [
              {
                "attribute_id": 0,
                "attribute_code": "string",
                "option_id": 0
              }
            ],
            "variant_is_promotion": 0,
            "variant_sku": "string",
            "variant_price": 0,
            "variant_special_price": 0,
            "variant_quantity": 0,
            "variant_promotion_start_date_timestamp": "2020-06-05T03:15:19.361Z",
            "variant_promotion_end_date_timestamp": "2020-06-05T03:15:19.361Z",
            "variant_is_flash_sales": true,
            "variant_campaign_status": 0
            "variant_attribute_hash": null,
            "message": "Giá KM không hợp lệ."
          }
        ]
  	  },
  "success": true,
  "error": {
    	"message": "string",
    	"details": "string",
    	"error_details": [
      		{
        		"property_name": "string",
        		"message": "string",
        		"value": {},
        		"code": "string"
      		}
    	]
  },
  "status_code": 200
}