Skip to content

Product

The product node

Method Type Description
id ID!
pk Int
name String!
shortDescription String!
description String!
category ProductCategoryNode
pictures ProductPictureNodeConnection!
price String
priceCurrency ProductPriceCurrency!
priceAmount Float
previousPrice Decimal
previousPriceCurrency ProductPreviousPriceCurrency
quantities ProductQuantityNodeConnection!
availabilities ProductAvailabilityNodeConnection!
outOfStock Boolean!
stores StoreNodeConnection!
storeGroups StoreGroupNodeConnection!
allStores StoreNodeConnection
modifiersGroups ProductComponentsGroupNodeConnection
appliedTaxes AppliedTaxNodeConnection
extraInfo JSONString
createdAt DateTime!
updatedAt DateTime!

List product categories

{
    productCategories {
        edges {
            node {
                pk
                name
            }
        }
    }
}

Create a product

mutation (
  $name: String!
  $categoryId: ID!
  $productComponentsGroups: [ID]!
  $price: Decimal!
  $priceCurrency: String
  $outOfStock: Boolean
  $shortDescription: String!
  $description: String!
  $stores: [ID]!
  $storeGroups: [ID]!
  $pictures: [ProductImageInput]
  $extraInfo: JSONString
){
  createProduct(
    input: {
      name: $name
      categoryId: $categoryId
      productComponentsGroups: $productComponentsGroups
      price: $price
      priceCurrency: $priceCurrency
      outOfStock: $outOfStock
      shortDescription: $shortDescription
      description: $description
      stores: $stores
      storeGroups: $storeGroups
      pictures: $pictures
      extraInfo: $extraInfo
    }
  ) {
    errors
    success
    product {
      id
    }
  }
}
{
  "name": "Pizza",
  "categoryId": 56,
  "productComponentsGroups": [5, 9, 8, 6],
  "price": "2.00",
  "priceCurrency": "USD",
  "outOfStock": false,
  "shortDescription": "Pizza short description",
  "description": "Pizza long description",
  "stores": [1, 2, 3],
  "storeGroups": [5, 8, 7]
}
{
    "data": {
        "createProduct": {
            "success": true,
            "errors": null,
            "product": {
              "id": "U3RvcmVOb2RlOjE5"
            }
        }
    }
}

Update a product

mutation (
  $id: ID!
  $name: String
  $categoryId: ID
  $productComponentsGroups: [ID]
  $price: Decimal
  $priceCurrency: String
  $outOfStock: Boolean
  $shortDescription: String
  $description: String
  $stores: [ID]
  $storeGroups: [ID]
  $extraInfo: JSONString
){
  createProduct(
    input: {
      id: $id
      name: $name
      categoryId: $categoryId
      productComponentsGroups: $productComponentsGroups
      price: $price
      priceCurrency: $priceCurrency
      outOfStock: $outOfStock
      shortDescription: $shortDescription
      description: $description
      stores: $stores
      storeGroups: $storeGroups
      extraInfo: $extraInfo
    }
  ) {
    errors
    success
    product {
      id
    }
  }
}
{
  "id": 90,
  "name": "Pizza - edited"
}
{
    "data": {
        "updateProduct": {
            "success": true,
            "errors": null,
            "product": {
              "id": "U3RvcmVOb2RlOjE5"
            }
        }
    }
}

Delete a product

mutation (
  $id: ID!
){
  deleteProduct(
    input: {
      id: $id
    }
  ) {
    errors
    success
  }
}
{
  "id": 90
}
{
    "data": {
        "deleteProduct": {
            "success": true,
            "errors": null
        }
    }
}

Add product picture

mutation (
  $productId: ID!
  $picture: Upload!
  $order: Int!
){
  createProductPicture(
    input: {
      productId: $productId
      picture: $picture
      order: $order
    }
  ) {
    errors
    success
  }
}
{
  "productId": 18,
  "picture": null,
  "order": 1
}
{
    "data": {
        "createProductPicture": {
            "success": true,
            "errors": null
        }
    }
}

Update product picture

mutation (
  $id: ID!
  $picture: Upload
  $order: Int
){
  updateProductPicture(
    input: {
      id: $id
      picture: $picture
      order: $order
    }
  ) {
    errors
    success
  }
}
{
  "id": 18,
  "picture": null,
  "order": 2
}
{
    "data": {
        "updateProductPicture": {
            "success": true,
            "errors": null
        }
    }
}

Delete product picture

mutation (
  $id: ID!
){
  deleteProductPicture(
    input: {
      id: $id
    }
  ) {
    errors
    success
  }
}
{
  "id": 18
}
{
    "data": {
        "deleteProductPicture": {
            "success": true,
            "errors": null
        }
    }
}

Add product quantity

mutation (
  $productId: ID!
  $storeId: ID!
  $order: Int!
){
  createProductQuantity(
    input: {
      productId: $productId
      storeId: $storeId
      quantity: $quantity
    }
  ) {
    errors
    success
  }
}
{
  "productId": 18,
  "storeId": 22,
  "quantity": 100
}
{
    "data": {
        "createProductQuantity": {
            "success": true,
            "errors": null
        }
    }
}

Update product quantity

mutation (
  $id: ID!
  $productId: ID
  $storeId: ID
  $order: Int
){
  updateProductQuantity(
    input: {
      id: $id
      productId: $productId
      storeId: $storeId
      quantity: $quantity
    }
  ) {
    errors
    success
  }
}
{
  "id": 2,
  "productId": 18,
  "storeId": 22,
  "quantity": 100
}
{
    "data": {
        "updateProductQuantity": {
            "success": true,
            "errors": null
        }
    }
}

Delete product quantity

mutation (
  $id: ID!
){
  deleteProductQuantity(
    input: {
      id: $id
    }
  ) {
    errors
    success
  }
}
{
  "id": 2
}
{
    "data": {
        "deleteProductQuantity": {
            "success": true,
            "errors": null
        }
    }
}

Add product availability

mutation (
  $productId: ID!
  $storeId: ID!
  $startTime: Time!
  $endTime: Time!
){
  createProductAvailability(
    input: {
      productId: $productId
      storeId: $storeId
      startTime: $startTime
      endTime: $endTime
    }
  ) {
    errors
    success
  }
}
{
  "productId": 18,
  "storeId": 22,
  "startTime": "10:00",
  "endTime": "13:00"
}
{
    "data": {
        "createProductAvailability": {
            "success": true,
            "errors": null
        }
    }
}

Update product availability

mutation (
  $id: ID!
  $storeId: ID
  $startTime: Time
  $endTime: Time
){
  updateProductAvailability(
    input: {
      id: $id
      storeId: $storeId
      startTime: $startTime
      endTime: $endTime
    }
  ) {
    errors
    success
  }
}
{
  "id": 18,
  "storeId": 22,
  "startTime": "10:00",
  "endTime": "13:00"
}
{
    "data": {
        "updateProductAvailability": {
            "success": true,
            "errors": null
        }
    }
}

Delete product availability

mutation (
  $id: ID!
){
  deleteProductAvailability(
    input: {
      id: $id
    }
  ) {
    errors
    success
  }
}
{
  "id": 18
}
{
    "data": {
        "deleteProductAvailability": {
            "success": true,
            "errors": null
        }
    }
}

List product taxes

query ($id: ID!){
    product(id: $id) {
        appliedTaxes {
            edges {
                node {
                    taxRate {
                        name
                        taxType
                        valueType
                        valueAmount
                    }
                }
            }
        }
    }
}