Orders and Removed Line Items
The Shopify Orders API returns all Line Items for the Order, including Line Items that have been removed/deleted in the Shopify Admin site. This can obviously lead to issues with incorrect calculations for an Order (totals, weights etc).
If you are deleting line items using the Shopify Admin page then you need to be aware that when updating the Order from Shopify using the fmEcommerce Link file you will still see all the original line items. For example in the following screenshot the last item (Camp Stool) has actually been removed in Shopify:
but is still being returned as an Order Line Item. If you view the Refunds tab you will see any deleted line items as Shopify creates a Refund line item for each deleted line item:
Also the fulfillable_quantity value for the Line Item will also now be zero:
You can use the presence of the Refund line item and the fulfillable_quantity value to determine whether a line item has been removed in Shopify. The Refund Line Item also includes the ID for the deleted line item so you can also use that to determine whether a line item has been removed and delete it from the fmEcommerce Link file if required and update any calculations (totals, weight etc).
Shopify are aware of this issue and will hopefully have a better solution in a future update to the Shopify API.