fix(ml): add family_name field required for User Products model
- ML's new User Products model requires family_name in item body - Use product name as family_name (generic product description) - Keep title for backward compatibility with legacy sellers
This commit is contained in:
@@ -173,8 +173,13 @@ def build_item_payload(
|
|||||||
shipping_payload["free_shipping"] = False
|
shipping_payload["free_shipping"] = False
|
||||||
shipping_payload["methods"] = []
|
shipping_payload["methods"] = []
|
||||||
shipping_payload["costs"] = [{"description": "Envio", "cost": str(shipping_cost)}]
|
shipping_payload["costs"] = [{"description": "Envio", "cost": str(shipping_cost)}]
|
||||||
|
# family_name is required for ML's User Products model (enabled sellers).
|
||||||
|
# It's a generic product description shared across variations.
|
||||||
|
family_name = inventory_row.get("name") or title
|
||||||
|
|
||||||
payload = {
|
payload = {
|
||||||
"title": title,
|
"title": title,
|
||||||
|
"family_name": family_name,
|
||||||
"category_id": meli_category_id,
|
"category_id": meli_category_id,
|
||||||
"price": round(float(price), 2),
|
"price": round(float(price), 2),
|
||||||
"currency_id": "MXN",
|
"currency_id": "MXN",
|
||||||
@@ -185,6 +190,7 @@ def build_item_payload(
|
|||||||
"pictures": [{"source": url} for url in _resolve_image_urls(images, base_url) if url],
|
"pictures": [{"source": url} for url in _resolve_image_urls(images, base_url) if url],
|
||||||
"shipping": shipping_payload,
|
"shipping": shipping_payload,
|
||||||
"attributes": [],
|
"attributes": [],
|
||||||
|
"seller_custom_field": inventory_row.get("part_number") or str(inventory_row.get("id")),
|
||||||
}
|
}
|
||||||
|
|
||||||
# Collect extra attribute IDs to avoid duplicates
|
# Collect extra attribute IDs to avoid duplicates
|
||||||
|
|||||||
Reference in New Issue
Block a user