Line_item id and partner_line_item_id is different

We use grapql API to create_order, we send partner_line_item_id along with API, After create order success we get the response from shiphero and also store line_item id that return from shiphero to our end for reference.

The problem is both partner_line_item_id and id is different from create the order and get order api. See example below
Response from create_order api
{
“order_create”: {
“request_id”: “5e9ba44e2a46d9fa6b9815ba”,
“complexity”: 10,
“order”: {
“id”: “T3JkZXI6MTIzMTYyMjM5”,
“order_number”: “100162”,
“line_items”: {
“edges”: [
{
“node”: {
"id": “TGluZUl0ZW06MzYxOTU5MjE1”,
"partner_line_item_id": “25”,
}
}
}
}

When get_order id T3JkZXI6MTIzMTYyMjM5 this is the response that we got

{
“data”: {
“order”: {
“request_id”: “5ea7fc448d74b1ffed5cda41”,
“complexity”: 201,
“data”: {
“id”: “T3JkZXI6MTIzMTYyMjM5”,
“line_items”: {
“pageInfo”: {
“hasNextPage”: false,
“startCursor”: “YXJyYXljb25uZWN0aW9uOjA=”,
“endCursor”: “YXJyYXljb25uZWN0aW9uOjA=”
},
“edges”: [
{
“node”: {
“line_item”: {
"id": “TGluZUl0ZW06MzYyNDA1MTM3”,
"partner_line_item_id": “25-123162239-1”,
“quantity”: 1
}
}
}
}
}

You see both id and partner_line_item_id is different? we want this id to map between data line from our site and your site,

Any suggestion why the id and partner_line_item_id is different? what should we do?
Thanks

Hi @prince!

That might be because the SKU you use to create the Order:

"id": "TGluZUl0ZW06MzYxOTU5MjE1",
"partner_line_item_id": "25",

Is a build kit, that has:

"id": “TGluZUl0ZW06MzYyNDA1MTM3”,
"partner_line_item_id": “25-123162239-1”,

As a component. If you try the following Query you should be able to see both, and their relationship:

{
  order(id: "T3JkZXI6MTIzMTYyMjM5") {
    request_id
    complexity
    data {
      id
      order_number
      shop_name
      line_items {
        edges {
          node {
            id
            partner_line_item_id
            sku
            quantity
            product_name
            product {
              kit
              components {
                sku
                name
              }
            }
          }
        }
      }
    }
  }
}

Let me know if this is not what you were referring to, or if I can help you with anything else.
Thanks!,
Tom

After I try to query I got this information, Kit = False So I don’t sure it is the case or not
{
“node”: {
“line_item”: {
“product”: {
"kit": false,
“sku”: “ZLP-1”,
},
“id”: “TGluZUl0ZW06MzYyNDA1MTM3”,
“partner_line_item_id”: “25-123162239-1”,
“sku”: “ZLP-1”,
“quantity”: 1
}
}
}

I think you miss my point here

  1. Wh. line_item id is different when we got from create_order response and when we get from get_order, It should not right? it should unique
  2. Why partner_line_item_id is changed from your-site when we create we send 25, and response from create_order return 25, But when we use get_order or webhook we get “25-123162239-1”

The main Idea is we need to know which line_item that shipped So we can match it with ourside, Because our E-commerce store support multiple line per Order Also.

Thanks.
Prince

Hi @prince
I apologize if I got that wrong.
So this is what you should be getting in response for that Query I posted above:

{
  "data": {
    "order": {
      "request_id": "5eb151b3540555a86348a3b8",
      "complexity": 101,
      "data": {
        "id": "T3JkZXI6MTIzMTYyMjM5",
        "order_number": "100162",
        "shop_name": "public-api",
        "line_items": {
          "edges": [
            {
              "node": {
                "id": "TGluZUl0ZW06MzYxOTU5MjE1",
                "partner_line_item_id": "25",
                "sku": "ZLP-ADU",
                "quantity": 1,
                "product_name": "Zleep",
                "product": {
                  "kit": true,
                  "components": [
                    {
                      "sku": "ZLP-1",
                      "name": "Zleep Sleep Patches"
                    }
                  ]
                }
              }
            },
            {
              "node": {
                "id": "TGluZUl0ZW06MzYyNDA1MTM3",
                "partner_line_item_id": "25-123162239-1",
                "sku": "ZLP-1",
                "quantity": 1,
                "product_name": "Zleep Sleep Patches",
                "product": {
                  "kit": false,
                  "components": []
                }
              }
            }
          ]
        }
      }
    }
  }
} 

For which you see the Kit:

 "id": "TGluZUl0ZW06MzYxOTU5MjE1",
                    "partner_line_item_id": "25",
                    "sku": "ZLP-ADU",

That has this component Inside:

"id": "TGluZUl0ZW06MzYyNDA1MTM3",
                    "partner_line_item_id": "25-123162239-1",
                    "sku": "ZLP-1",

And that is because it was turned into a Kit and the component was added on 04/20/2020 09:16 AM.

Maybe you are making a query for the shipment instead of the order?
That way, if its a Build Kit (such as this one), it will return the component, instead of the Kit

@tomasw

Yeah we use shipment The main goal that we query the order

  1. we want to find which order and line item in order has been ship and we want to mark the line item in our system for tracking label and tracking number,
  2. We want the unique id the we can match line item that have been shipped from your system and our system, So we can mark it as shipped in our system and send customer about the tracking info via email.
  3. Imagine that Order have multiple line and each line have it own tracking, like partial order, So we need the unique id that we can use to match it from your system with our system about shipment info, now both id and partner_line_item_id has been change due to it return to kit(I dont know about kit, can you explain more about this? what is this and why id and partner_line_item_id has been changed? )
  4. Do you have any suggestion that what query that we should use to solve the scenario above? the main goal is match shipping info for line items between your system and our system.

Hi @prince
So the reason you are seeing this is because that SKU: ZLP-ADU is a Build Kit which means it is split into components.
And that’s why, for the Shipment, we register the Component’s SKU, instead of the Kit’s SKU

On the other hand, for Kits that are not Build Kits, when you create a Shipment it will register the Kit’s SKU instead of its components.

So a possible solution might be either to turn this Kit into a Build Kit: No so when you get check the shipment it matches the SKU you are expecting.
Or you could query for the line items “outside” of the shipment and check the quantity_shipped & quantity_pending_fulfillment with something like this:

{
  order(id: "125923578") {
    request_id
    complexity
    data {
      id
      order_number
      shop_name
      line_items {
        edges {
          node {
            id
            partner_line_item_id
            sku
            quantity
            product_name
            quantity_shipped
            quantity_pending_fulfillment              
            }
          }
        }
      }
    }
  }

This will return you something like this:

{
  "data": {
    "order": {
      "request_id": "5eb41b5898825afe23576962",
      "complexity": 101,
      "data": {
        "id": "T3JkZXI6MTI1OTIzNTc4",
        "order_number": "MO823",
        "shop_name": "Manual Order",
        "line_items": {
          "edges": [
            {
              "node": {
                "id": "TGluZUl0ZW06MzY4MTIyMjMy",
                "partner_line_item_id": "MO823-280895730",
                "sku": "Kit4Test12",
                "quantity": 1,
                "product_name": "Kit for Testing",
                "quantity_shipped": 0,
                "quantity_pending_fulfillment": 0
              }
            },
            {
              "node": {
                "id": "TGluZUl0ZW06MzY4MTIyMjQ5",
                "partner_line_item_id": "MO823-280895730-125923578-0",
                "sku": "1547733400",
                "quantity": 1,
                "product_name": "Product nr2 for Kit Testing",
                "quantity_shipped": 1,
                "quantity_pending_fulfillment": 0
              }
            },
            {
              "node": {
                "id": "TGluZUl0ZW06MzY4MTIyMjUw",
                "partner_line_item_id": "MO823-280895730-125923578-1",
                "sku": "KitTesting1234",
                "quantity": 4,
                "product_name": "Product nr1 for Kit Testing",
                "quantity_shipped": 4,
                "quantity_pending_fulfillment": 0
              }
            }
          ]
        }
      }
    }

Where you are able to see the Kit and its component with their corresponding quantity pending to fulfill

@tomasw We want tracking_numbber and carrier also for sending customer email. How we accomplish this?

Hi @prince!
I apologize for the delay on this.
Is there any particular reason you are making this a Build Kit?
You could always make it a Regular Kit and then you should be able to see the Kit when querying for the shipment instead of the components
Thanks in advance!
Tom