How to stop my code accessing FulfillmentOrderLineItem. lineItem

How to stop my code accessing FulfillmentOrderLineItem. lineItem

Ashley_Kennerle
Shopify Partner
58 0 7

I'm trying to update to the new FulfillmentOrders system but apparently:

 

The orders query made by your private app is accessing the line_item field on fulfillment order.  This was deprecated in API version 2023-01, so there is no immediate need to update.  If you are having trouble adapting your app, please start a new thread in this community and we will try to help.  

 

Here is the code I'm using - as far as I can understand it doesn't look like I'm using that field. Where have I made the mistake please?

 

		mutation {
			fulfillmentCreateV2(fulfillment: {
				notifyCustomer: true
				trackingInfo: {
					url: "'.$line_item['ShippingTrackingURL'].'"
					number: "'.$ShippingTrackingURL.'"
					company: "Royal Mail"
				}
				lineItemsByFulfillmentOrder: {
					fulfillmentOrderId: "gid://shopify/FulfillmentOrder/'.$line_item['FulfillmentOrderID'].'"
					fulfillmentOrderLineItems: [
						{
							id: "gid://shopify/FulfillmentOrderLineItem/'.$line_item['FulfillmentOrderLineItemID'].'"
							quantity: 1
						}
					]
				}
			}) {
				fulfillment {
					id
					status
					trackingInfo {
						url
						number
						company
					}
				}
				userErrors {
					field
					message
				}
			}
Replies 13 (13)

RobZone
Shopify Staff
76 10 22

The above call to the createFulfillmentV2 mutation is 100% correct.  👍

 

I was referring to a the orders query being made by the app.  I pasted it into GraphiQL to highlight the deprecated elements:

RobZone_0-1676569940811.png

 

To learn more visit the Shopify Help Center or the Community Blog.

Ashley_Kennerle
Shopify Partner
58 0 7

Thanks RobZone, I'm a little bit confused I'm afraid!

 

I had been using this query to store the LineItem ID and the FulfillmentOrderLineItem ID on the same line in my line items database (along with SKU, custom attributes etc). This way, when I want to create a fulfilment for a single item, I can use the LineItem ID and look up its parent FulfillmentOrderLineItem ID to use when creating the fulfilment.

 

If I get the LineItem information at the Order level, I don't know how to associate it with the correct FulfillmentOrderLineItem - please could you help me understand?

 

Thanks!

Ashley

RobZone
Shopify Staff
76 10 22

Hi Ashley,

 

What are you using the order line item for?  We are planning on adding customAttributes as a field on the fulfillment order line item in the future.  SKU is already available.  What other fields?

 

The fulfillment order API and data model decouples the fulfillment from the sale. For example, the fulfillment of an order can be split between locations.  The order can contain a single line item with a quantity of 5. If all 5 are not in stock at a single location, the order will split between the two locations.  So there is a single order line item with a quantity of 5, but two separate fulfillment orders and fulfillment order line items with different quantities that add up to 5. 

 

The fulfillment order should be your source of truth for what to fulfill.  If your database assumes a 1-1 relationship, you will run into problems with split fulfillments, if they occur for you.  

 

I hope this helps.

 

Cheers,

Rob

To learn more visit the Shopify Help Center or the Community Blog.

Ashley_Kennerle
Shopify Partner
58 0 7

Hi Rob, if I have an order with two items (same SKU bit different Custom Attributes), my query gives me two different FulfillmentOrderLineItemIDs - one for each item. I store these details in my order processing database and then when each one is ready to ship, I can look up the FulfillmentOrderLineItemID for that item and then create a Fulfillment.

 

I'm not sure how to do it otherwise - how would I be able to associate the FulfillmentOrderLineItemID with the correct item?

RobZone
Shopify Staff
76 10 22

What happens if the order is edited in Shopify?  Do you support that, or is your application the source of truth?

If the order cannot be edited by Shopify admin or an app, storing the fulfillment order and fulfillment order line item ids will give you the info you need.  An order edit may invalidate these associations. Does your app already re-process an order in reaction to order edits?

I hope that helps and does not actually makes it worse.

To learn more visit the Shopify Help Center or the Community Blog.

Ashley_Kennerle
Shopify Partner
58 0 7

The order is only edited in my app. I retrieve the order details from Shopify when the order is placed and then fulfil each item of the order in turn as it is shipped.

 

I just need to know how to associate the FulfillmentOrderLineItemID with the corresponding line item ID if I can no longer retrieve the Line Item as a child of the FulfillmentOrderLineItem

Ashley_Kennerle
Shopify Partner
58 0 7

Hi Rob, I still don't understand how to solve this problem.

 

If Shopify creates a FulfillmentOrderLineItemID for each item in my order but doesn't supply identifying information (the LineItem ID) - how will I know which FulfillmentOrderLineItemID should be associated with which Line Item when I come to fulfil each Line Item?

 

Is it possible to somehow look up the FulfillmentOrderLineItemID from the LineItem and do it the other way around?

RobZone
Shopify Staff
76 10 22

The fulfillment order line item will have the product SKU and name.  Why do you need the order line item?

To learn more visit the Shopify Help Center or the Community Blog.

Ashley_Kennerle
Shopify Partner
58 0 7

Hi Rob, I need to retrieve the Custom Attributes for the line item, quite often orders will have the same SKU but different personalisation options stored in the Custom Attributes.

Ashley_Kennerle
Shopify Partner
58 0 7

Hi Rob, just checking in to see if the Custom Attributes per line item will be available?

Ashley_Kennerle
Shopify Partner
58 0 7

Hi Rob, just checking in to see if the Custom Attributes per line item will be available?

RobZone
Shopify Staff
76 10 22

I do not have an ETA on adding this field to the fulfillment order line item.  We will go through a full deprecation cycle when the new attributes are in place.  In the meantime, you can safely use the deprecated line_item connection. 

To learn more visit the Shopify Help Center or the Community Blog.

tm-af
Shopify Partner
1 0 0

Hi, I just wanted to add that we also have an issue with missing fields on `FulfillmentOrderLineItem` / no direct link between `Order.lineItems`.

 

We are in a similar situation where we retrieve `customAttributes` from `LineItem`. In instances where there are multiple line items on the order from which we retrieve `customAttributes`, not being able to differentiate between `LineItem` will render us unable to offer certain products.