InventoryItem has multiple variant relationships?

I’ve just noticed on InventoryItem that variant is now deprecated and we have variants instead, and that then says:

A paginated list of the variants that reference this inventory item.

I’m super confused here, how can an inventory item be connected to multiple variants?

Or is this a documentation mistake?

Hey @Luke -

Thanks for calling this out. Just confirming this is intentional on our end. The main case where one InventoryItem is referenced by more than one variant is combined listings. When a merchant sets up a combined listing, the parent product’s variant and the linked child product’s variant both point to the same InventoryItem, so stock is shared rather than duplicated. That’s why variant (singular) was deprecated in favor of variants as a paginated connection.

For products that aren’t part of a combined listing (and have no other linked-variant relationship), you’ll typically still see just the one variant in the list, so behaviour matches the old singular field for those cases.

Let me know if I can clarify anything on our end here.

@Alan_G I’m testing the combined listings app where I added a product (with its 1 default variant) to a combined listing, but when I check the inventory_item_id, the referenced product variant and the combined listing’s variant record have different inventory item IDs:

I might be configuring this incorrectly (or misunderstanding it completely), but do you happen to have an example on how to set up the combined listings app so the combined listing’s variant uses the same inventory item ID as the product variant it’s referencing?

The reason I want to test this is we have an app where we store the inventory_item_id in our Variant table (for inventory updates) and where we have a unique constraint for this column since this used to be a 1-1 relationship. So I just want to confirm duplicate inventory item IDs could really occur before we make any changes.

Hey @Jonathan-HA -

Thanks for testing this and sharing the screenshots. I did a bit more checking here, and your setup looks consistent with what I’d expect today: combined listings create/relate parent and child product/variant records, but I’m not seeing a way to configure the combined listing’s parent variant to reuse the child product variant’s inventoryItem.id.

I also want to clarify my earlier reply: the InventoryItem.variants connection is intentional, but the reason for moving from singular variant to paginated variants is mainly to make the API compatible with future support for multiple variants referencing the same inventory item. The changelog notes that the connection initially returns a single node.

So for your app, I’d still recommend making the data model tolerate this becoming many-to-one over time, since the API contract has moved in that direction, but I can’t confirm a concrete timeline on when those changes will happen completely.

Let me know if I can help out with the exact query!

That makes sense, thanks for clarifying @Alan_G !