In order to fulfil orders, Jungle needs to know about your products. You can store your product information in Jungle, and manipulate it over time.
Creating a Product
Products are initially created with only a few properties that are used to identify it. Create one like this:
mutation ProductCreate {
productCreate(
input: { name: "My great product", xids: ["xid:jungle/Product:shopify/productid/my-shop:1237"], barcode: "123ABC" }
) {
ok
... on MutationSuccess {
objects {
id
typename
}
}
}
}
The xid
property in the example above references the product ID in an external system. Like most
other Jungle objects, products can have multiple XIDs. Whenever a client refers to a product
in the Jungle API, it can use an XID in place of the Jungle ID. More information on
XIDs can be found here.
The response to this mutation will indicate that multiple objects were created: one for the product itself, and one for each of the XIDs. Jungle object IDs will be returned for all of them.
After creating a product, an API client can update it with additional information.
Updating a Product
Jungle's API provides a number of mutations for adding/changing your product details. Following are a few examples...
Set the Name and Description
Set a product's name and description like so:
mutation {
productSetName(
input: {
productId: "xid:jungle/Product:shopify/productid/my-shop:1234"
name: "A better product name"
description: "This product is great!"
}
) {
ok
}
}
Set the Weight
Configure a product's weight (in grams) like so:
mutation ($input: ProductSetWeightInput!) {
productSetWeight(input: { productId: "xid:jungle/Product:shopify/productid/my-shop:1234", weight: 34.5 }) {
ok
}
}