Add a product to a warehouse with on hand quantity = 0

Hi dear community,

I am trying to add a warehouse product (for an existing product) with the property onHand = 0, but the API keeps returning an error.

Why does the ShipHero system forbid to provision a product to a warehouse without inventory (onHand= 0) via the method product_add_to_warehouse whereas this very same provision is allowed via the method product_create ?

product_add_to_warehouse Query:

mutation {
product_add_to_warehouse(data: {
    sku: "CHAIR12348"
    warehouse_id: "V2FyZWhvdXNlOjExMzk3"
    on_hand: 0
  }) {
    request_id
    complexity
    warehouse_product {
      id
      warehouse_id
      warehouse_identifier
    }
  }
}

product_add_to_warehouse Response:

{
  "errors": [
    {
      "message": "Unexpected Error",
      "operation": "product_add_to_warehouse",
      "field": "product_add_to_warehouse",
      "request_id": "5e187ba578a1a03de0211c17",
      "code": 22
    }
  ],
  "data": {
    "product_add_to_warehouse": null
  }
}

product_create Query:

mutation {
  product_create(
    data: {
      name: "wood chair"
      sku: "CHAIR12350"
      price: "25.00"
      warehouse_products: {
        warehouse_id: "V2FyZWhvdXNlOjExMjg4"
        on_hand: 0
        inventory_bin: "Bin A1"
        reserve_inventory: 0
        replenishment_level: 1
        reorder_level: 1
        reorder_amount: 20
        custom: false
      }
      value: "15.00"
      barcode: "2233443356chair"
      country_of_manufacture: "US"
      dimensions: { weight: "12", height: "25", width: "10", length: "25" }
      kit: false
      kit_build: false
      no_air: false
      final_sale: false
      customs_value: "1.00"
      not_owned: true
      dropship: false
    }
  )
  {
    request_id
    complexity
    product {
      id
      sku
    }
  }
}

product_create Response:

{
  "data": {
    "product_create": {
      "request_id": "5e187e72ac5c3f6a80cf9652",
      "complexity": 10,
      "product": {
        "id": "UHJvZHVjdEluZm86MjY5MTY4NjA5",
        "sku": "CHAIR12350"
      }
    }
  }
}

Hi @Gary !
I noticed your account is a 3PL account, so you’ll probably have to send that request with customer_account_id:"XXXX" to be sure the product gets created on your client’s account.
It would look something like this:

mutation {
product_add_to_warehouse(data: {
    sku: "CHAIR12348"
    warehouse_id: "V2FyZWhvdXNlOjExMzk3"
    customer_account_id:"XXXX"
    on_hand: 0
  }) {
    request_id
    complexity
    warehouse_product {
      id
      warehouse_id
      warehouse_identifier
    }
  }
}

Let me know if this doesn’t work for you.
Thanks!
Tom

Hi @tomasw,

Thank you for your quick answer.

Unfortunately adding a customer_account_id to the data of product_add_to_warehouse mutation, does not make any difference: the ShipHero system does not accept the value 0 for the parameter onHand.

mutation {
  product_add_to_warehouse(data: {
    sku: "CHAIR12352"
    customer_account_id: "QWNjb3VudDo2MDEx"
    warehouse_id: "V2FyZWhvdXNlOjExMzk3"
    on_hand: 0
  }) {
    request_id
    complexity
    warehouse_product {
      id
      warehouse_id
      warehouse_identifier
    }
  }
}
{
  "errors": [
    {
      "message": "Unexpected Error",
      "operation": "product_add_to_warehouse",
      "field": "product_add_to_warehouse",
      "request_id": "5e188cf8a93ce1dd11e96bd2",
      "code": 22
    }
  ],
  "data": {
    "product_add_to_warehouse": null
  }
}

Hi @Gary !
I’ve already submitted a request for an engineer to take a look at this behavior.
I’ll let you know as soon as I have an update on it.
Thanks for the patience!
Tom

Hi @Gary!
This issue should be fixed by now.
Thanks for eh patience on this!
Tom

Hi @tomasw,

I confirm that on my side, the problematic case has been solved.

Cheers !

1 Like