I’m bulk-creating items using the bulkCreateOrReplaceInventoryItem
API. Some of my products are listed under the wrong categories. I can’t find any field in the request payload by which I can mention the category id of each item.
Here are the API docs: https://developer.ebay.com/api-docs/sell/inventory/resources/inventory_item/methods/bulkCreateOrReplaceInventoryItem
Can anyone help me provide the category details while creating new items on eBay?
Here is my request payload:
foreach ($data as $key => $item) {
$o = array(
"sku" => $item['sku'],
"locale" => $item['locale'],
"product" => array(
"title" => $item['title'],
"description" => $item['description'],
"aspects" => array(),
"brand" => $item['brand'],
"mpn" => $item['mpn'],
"imageUrls" => $item['images'],
"aspects" => $item['aspects']
),
"condition" => $item['condition'],
// "conditionDescription" => $item['conditionDescription'],
"availability" => array(
"shipToLocationAvailability" => array(
"quantity" => $item['quantity']
)
),
);
if ($item['condition'] != 'NEW') {
$o['conditionDescription'] = $item['conditionDescription'];
}
$object[] = $o;
}
$object = array('requests' => $object);
2
Answers
you’d want to use the product field and specify the primaryProductCategory field to set the category for the item. The primaryProductCategory is a container that is used to identify the primary category in which the item will be listed on eBay.
In the above code, I added the
primaryProductCategory
array into the product array. You’ll need to make sure that your$item
array includes thecategoryId key
, and its value should be the ID of the category you want to list the item under. The value ofcategoryId
should be a string.How can I add the variations of the products to this request ?