Missing Links in the GraphQL API Documentation

The relationship between some of the documented objects is lacking. For example:

  • A fulfillmentOrder has a delivery method (gid://shopify/DeliveryMethod/123456) and an order has x number of shippingLines (gid://shopify/ShippingLine/987654), but we can only guess at what the relationship between the two objects is. According to the latest documentation, no other object uses the DeliveryMethod. (See also: Is It Possible To Get The Shipping Rate From An Order?)
  • As mentioned elsewhere, a fulfillmentOrder has x number of FulfillmentOrderLineItem and an order has y number of OrderLineItem, but we can only guess at which FulfillmentOrderLineItem correlate to which OrderLineItem.
  • As mentioned in the thread linked directly above, we can only guess at which discount allocations apply to the line items from a fulfillment order.

Some details are missing regarding which circumstances give rise to some scenarios. For example:

  • As mentioned elsewhere, it’s not clear what circumstances would cause there to be multiple shippingLines for an order.

Here’s an example of the issue described above, regarding the allocation of discounts to line items.

Summary:

A customer has purchased 1 product, SKU example-1. A merchant has configured a buy-one-get-one promotion, so the customer receives a second product, example-1, at no charge.

For whatever reason, the merchant splits the fulfillment order in half. There is one example-1 product on each fulfillment order. Fulfillment Order #1 has the discounted item. Fulfillment Order #2 has the regular priced item.

The merchant sends the Fulfillment Order #1 over to the fulfillment service for fulfillment.

Issue:

Neither fulfillment order indicates the actual sale price of the line items in the fulfillment order.


Fulfillment Order #1


ID:

gid://shopify/FulfillmentOrder/111

The Fulfillment Order Line items:

[ {

“id” : “gid://shopify/FulfillmentOrderLineItem/1112”,

“inventoryItemId” : “gid://shopify/InventoryItem/1234”,

“sku” : “example-1”,

“originalUnitPriceSet” : { “shopMoney” : “100.00” }

} ]

The Order Line Items:

[ {

“id”: “gid://shopify/LineItem/444”,
“sku”: “example-1”,

“quantity”: 1,
“unfulfilledQuantity”: 0,

“discountedUnitPriceAfterAllDiscountsSet”: { “shopMoney”: { “amount”: “0.0” } },

“variant”: { “inventoryItem”: { “id”: “gid://shopify/InventoryItem/1234” } }

},

{

“id”: “gid://shopify/LineItem/555”,
“sku”: “example-1”,

“quantity”: 1,
“unfulfilledQuantity”: 1,

“discountedUnitPriceAfterAllDiscountsSet”: { “shopMoney”: { “amount”: “100.00” } },

“variant”: { “inventoryItem”: { “id”: “gid://shopify/InventoryItem/1234” } }

} ]


Fulfillment Order #2


ID:

gid://shopify/FulfillmentOrder/222

The Fulfillment Order Line items:

[ {

“id” : “gid://shopify/FulfillmentOrderLineItem/2221”,

“inventoryItemId” : “gid://shopify/InventoryItem/1234”,

“sku” : “example-1”,

“originalUnitPriceSet” : { “shopMoney” : “100.00” }

} ]

The Order Line Items:

[ {

“id”: “gid://shopify/LineItem/444”,
“sku”: “example-1”,

“quantity”: 1,
“unfulfilledQuantity”: 0,

“discountedUnitPriceAfterAllDiscountsSet”: { “shopMoney”: { “amount”: “0.0” } },

“variant”: { “inventoryItem”: { “id”: “gid://shopify/InventoryItem/1234” } }

},

{

“id”: “gid://shopify/LineItem/555”,
“sku”: “example-1”,

“quantity”: 1,
“unfulfilledQuantity”: 1,

“discountedUnitPriceAfterAllDiscountsSet”: { “shopMoney”: { “amount”: “100.00” } },

“variant”: { “inventoryItem”: { “id”: “gid://shopify/InventoryItem/1234” } }

} ]

Notes:

  • We can see that one order line item has been discounted and the other is the full price.
  • If we pull in data from all existing Fulfillments for the Order (not Fulfillment Orders), then we may be able to infer that the line item associated with Fulfillment Order #1 is the Order Line Item with the id gid://shopify/LineItem/444 because it has an unfulfilled quantity of 0. However, this may be unreliable if multiple fulfillments are being handled at the same time.

Side Note:

A Fulfillment (not Fulfilment Order) is connected to the associated Line Items. This is not helpful for the problem at hand.

Areas of further interest:

If we repeat the above example and add combinations of bogo offers, items, and piecemeal fulfillment requests, then we will see some confounding things:

  • The savings from a bogo offer that is applied twice to an order of six of the same products will be distributed across all of the line items.
  • An order with one bogo discount and four of the same products will have three order line items. The discounted product and its associated product are separated onto different line items. The other two items at the regular price are combined.
  • Requesting fulfillment for a single item will result in a new fulfillment order being created (effectively splitting it – this is a good thing).

Conclusion:

There may be a way to tease out which fulfillment order line items are associated with which order line items, but it is not obvious and/or it will not be linear. It is possible to guess, but there will be edge cases and problems for merchants, app developers, and Shopify alike. The sensible thing to do seems to be to include “foreign keys” associating fulfillment order line items and order line items. Finally, if this is a misunderstanding on our part, then we’d all like to know.

Hi Guest4,

Thanks for highlighting these documentation gaps - I’ll connect with our internal team to give them this feedback.

1 Like

Thank you, Liam.