Line Item Quantity not fulfilled using "shipment_create"

Hi
I create shipment of an order using shipment mutation API call but the line item still showing “pending” state.

here is my request

mutation {

shipment_create(
data: {
order_id: “XXX…6MTQ2MzQ3OTQy”
warehouse_id: “XXX…XNlOjY0OTAx”
customer_account_id: “XXX…udDo1NjkxMA==”
address: {
name: “John”
address1: “2543 Johnson St.”
address2: “Apt. 2”
city: “Oklahoma”
state: “Oklahoma”
zip: “73008”
country: “US”
phone: “5555555555”
}
line_items: { line_item_id: “xxx…06NDE2NzM4NTQ0”, quantity: 12 }
labels: {
address: {
name: “John”
address1: “2543 Johnson St.”
address2: “Apt. 2”
city: “Oklahoma”
state: “Oklahoma”
zip: “73008”
country: “US”
phone: “5555555555”
}
carrier: “UPS”
shipping_name: “UPS - Ground”
shipping_method: “Ground”
cost: “0.00”
dimensions: { weight: “12”, height: “12”, width: “12”, length: “12” }
label: {
paper_pdf_location: “exampleurl.com
thermal_pdf_location: “exampleurl.com
pdf_location: “exampleurl.com
}
line_item_ids: “xxx…6NDE2NzM4NTQ0”
tracking_number: “1234434242444444434”
}
}
) {
request_id
complexity
shipment {
id
legacy_id
order_id
user_id
warehouse_id
pending_shipment_id
address {
name
address1
address2
city
state
country
zip
phone
}
picked_up
needs_refund
refunded
delivered
shipped_off_shiphero
dropshipment
created_date
line_items(first: 2) {
edges {
node {
id
line_item_id
quantity
}
}
}
}
}
}

here is my response
{
“data”: {
“shipment_create”: {
“request_id”: “xxx…0968d73259300d”,
“complexity”: 10,
“shipment”: {
“id”: “xxx…Q6MTAzMTEyMzc0”,
“legacy_id”: 103112374,
“order_id”: “xxx…TQ2MzQ3OTQy”,
“user_id”: null,
“warehouse_id”: “xxx…XNlOjY0OTAx”,
“pending_shipment_id”: null,
“address”: null,
“picked_up”: false,
“needs_refund”: false,
“refunded”: false,
“delivered”: false,
“shipped_off_shiphero”: true,
“dropshipment”: false,
“created_date”: “2020-10-02T12:12:23+00:00”,
“line_items”: {
“edges”: [
{
“node”: {
“id”: “Uxxxxxx2hxxxxBlZExpbmVJdGVtOjE4Mzc3MjQwNw==”,
“line_item_id”: “TGluZUl0ZW06NDE2NzM4NTQ0”,
“quantity”: 12
}
}
]
}
}
}
}
}

Why it is still showing “pending” to fulfill since I have fufilled all 12 quantities

Please clear these things :slight_smile:
Thanks in advance

Hi @khungersumit!
That is because to mimic a shipment on the app you will need to make three Mutations:

  1. Shipment Create mutation
  2. Inventory Remove mutation
  3. Order Update Fulfillment Status mutation

1 creates the shipment+label, 2 removes the inventory and 3 sets the fulfillment status of the order and the line items

We have an example here --> https://developer.shiphero.com/order-fulfillment/

Let me know if that doesn’t help or I could help clarify anything.
Thanks in advance!
Tom

@tomasw
I did all the steps but still why Quantity shipped showing 0 here as show in the screenshot. because of this, I am not able to figure our using API LineItem quantity_shipped is showing returning 0.

                                        "quantity": 1,
                                        "price": "1000.00",
                                        "product_name": "SProd",
                                        "option_title": null,
                                        "fulfillment_status": "fulfilled",
                                        "quantity_pending_fulfillment": 0,
                                        "**quantity_shipped**": 0,
                                        "customs_value": "0.00",
                                        "subtotal": "1000.00"

Hi @khungersumit
The quantity_shipped refers to the quantity shipped using the ShipHero App, as for the shipments made outside of ShipHero (Stores, Public API) they won’t affect this field.
For this purpose (shipping outside of ShipHero App) you will need to see the quantity_pending_fulfillment, quantity, and the shipments made if necessary.
Thanks!
Tom

Hi @tomasw

I am facing some weird scenario PARTIAL_UPDATE CASE

1). I had an order with 2 lineitems (each item is of Quantity 2)
2). I created shipment of 1st line item with 2 quantity. (shipment_create mutation)
3). I removed the inventory (inventory_remove mutation)
4). Since I did a partial update of this order, so I used order_update_line_items for the above line item which I fulfilled in 1-3 steps.

Now when I checked the Order at dasbhoard it shows like following as shown in screenshot for that shipped line item and in API it is showing line this
“node”: {
“id”: “TGluZUl0ZW06NDI3Nzc2NTQ0”,
“sku”: “100-2”,
“product”: {
“id”: “UHJvZHVjdEluZm86Mjc1MDI3MTAw”,
“sku”: “100-2”,
“dimensions”: {
“weight”: “0.0051 lb”
}
},
quantity”: 2,
“price”: “100.00”,
“product_name”: “AirPods”,
fulfillment_status”: “fulfilled”,
quantity_pending_fulfillment”: 2,
quantity_shipped”: 0
}

Problem: Nowhere if you check the above API response it is still showing quantity_pending_fulfillment:2, what is the reason of this.
I was expecting it to be 0 since I have fulfilled both Quantity of this line item??

Please check this case

Hi @khungersumit!
That is correct, if you want to partially fulfill the order (only one line item) you will also need to update the quantity_pending_fulfillment when sending the order_update_line_items
Let me know if that doesn’t help.
Thanks again!
Tom

Ok @tomasw

What my requirement is I just only want to know how many items have been shipped using the data which I get from Order Line items
will it be the correct way If if do like the following

QuantityShipped = Quantity - quantityPendingFulfillmet;

I believe so @khungersumit
And also check the status in case it has been canceled instead.
You could also do the calculation of shipped quantities based on the shipments, but the approach mentioned above would be faster