Orders line item: deleted variant_ids are not nullified

“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.

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.