Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Orders line item: deleted variant_ids are not nullified

Orders line item: deleted variant_ids are not nullified

jbseo
Visitor
2 0 0

"line_items" of orders: https://shopify.dev/api/admin-rest/2022-01/resources/order#resource_object

 

  • product_id: The ID of the product that the line item belongs to. Can be null if the original product associated with the order is deleted at a later date.
  • variant_id: The ID of the product variant.
  • product_exists: deleted from description... It indicates that the original product is deleted.

It gives information about whether product is deleted or not, but not about variant_id.

It is painful to check if variant_id is still alive.

 

Can I use 'variant_inventory_management' to assume that the corresponding variant is alive?

The meaning of variant_inventory_management is not documented, but this value for deleted variant seems to be null.

Reply 1 (1)

jbseo
Visitor
2 0 0

I found the meaning of "inventory_management" from product variant page:

 

https://shopify.dev/api/admin-rest/2022-01/resources/product-variant#resource_object

 

inventory_management
The fulfillment service that tracks the number of items in stock for the product variant. Valid values:
  • shopify: You are tracking inventory yourself using the admin.
  • null: You aren't tracking inventory on the variant.
  • the handle of a fulfillment service that has inventory management enabled: This must be the same fulfillment service referenced by the fulfillment_service property.

 

It can be null when "Track quantity" of the product is disabled.