JSON API
...
Examples
Batch Updates
Categories
1min
if you are using category merchandising and want to associate products with the categories, then first index a category item and then index products by creating their relationship with the category products can be mapped to multiple categories following is an example of how to do it \[ { "id" "men shirts", "type" "klevu category", "attributes" { "name" { "default" "shirts" }, "url" "https //test myshopify com/collections/men shirts", "categorypath" "mens;shirts" } }, { "id" "1", "type" "klevu product", "relations" { "categories" { "values" \[ "men shirts" ] } }, "attributes" { "name" { "default" "shirt" }, "image" { "default" { "url" "https //4 imimg com/data4/ao/da/my 24693421/comfortable office chair jpg" } }, "url" "https //test myshopify com/products/black shirt", "shortdescription" { "default" "this is a black shirt available in different sizes " } } }, { "id" "2", "type" "klevu product", "relations" { "parentproduct" { "values" \[ "1" ] }, "categories" { "values" \[ "men shirts" ] } }, "attributes" { "name" { "default" "shirt" }, "image" { "default" { "url" "https //4 imimg com/data4/ao/da/my 24693421/comfortable office chair jpg" } }, "price" { "gbp" { "saleprice" 80 } }, "url" "https //test myshopify com/products/black shirt s", "shortdescription" { "default" "black shirt" }, "size" "s" } }, { "id" "3", "type" "klevu product", "relations" { "parentproduct" { "values" \[ "1" ] }, "categories" { "values" \[ "men shirts" ] } }, "attributes" { "name" { "default" "shirt" }, "image" { "default" { "url" "https //4 imimg com/data4/ao/da/my 24693421/comfortable office chair jpg" } }, "price" { "gbp" { "saleprice" 100 } }, "url" "https //test myshopify com/products/black shirt m", "shortdescription" { "default" "black shirt" }, "size" "m" } } ] for a complex product, ensure mapping all variants to the category items of different types like categories, products, etc can be part of the same request payload order should be maintained when objects are being related i e if you are mapping a product to a category, then the category should be created before the product