You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过bulkCreateOrReplaceInventoryItem API批量创建商品时设置分类

如何在ebay bulkCreateOrReplaceInventoryItem API中设置商品分类ID

要给批量创建的商品指定正确分类,你需要在每个inventory item的根层级添加primaryCategory字段(若需二级分类可追加secondaryCategory),该字段并非嵌套在product对象内,这是你之前遗漏的关键配置。

字段说明

  • primaryCategory.categoryId:必填的一级分类ID,需使用对应ebay站点的有效分类ID值
  • secondaryCategory.categoryId:可选的二级分类ID,仅部分分类体系支持二级层级

修改后的请求Payload示例

foreach ($data as $key => $item) {
    $o = array(
        "sku" => $item['sku'],
        "locale" => $item['locale'],
        // 添加一级分类配置
        "primaryCategory" => array(
            "categoryId" => $item['categoryId']
        ),
        // 如需二级分类可取消注释
        // "secondaryCategory" => array(
        //     "categoryId" => $item['secondaryCategoryId']
        // ),
        "product" => array(
            "title" => $item['title'],
            "description" => $item['description'],
            "aspects" => $item['aspects'],
            "brand" => $item['brand'],
            "mpn" => $item['mpn'],
            "imageUrls" => $item['images']
        ),
        "condition" => $item['condition'],
        "availability" => array(
            "shipToLocationAvailability" => array(
                "quantity" => $item['quantity']
            )
        ),
    );
    if ($item['condition'] != 'NEW') {
        $o['conditionDescription'] = $item['conditionDescription'];
    }
    $object[] = $o;
}
$object = array('requests' => $object);

关键提示

  • 未指定分类ID时,ebay会自动通过商品标题、属性等匹配分类,这是导致你出现分类错误的核心原因
  • 分类ID需对应目标站点的分类体系,可通过ebay官方分类工具或分类API查询获取有效ID值

内容的提问来源于stack exchange,提问作者habib

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.18 04:30:07