The merchandise with id gid://shopify/ProductVariant/xxxx does not exist.'

Solved

The merchandise with id gid://shopify/ProductVariant/xxxx does not exist.'

g3misa
Shopify Partner
24 5 15

I am using the storefront API with hydrogen and using the cartCreate mutation.  I have 20 line items that I’m passing to cartCreate and there is one line item that errors out:

 

'The merchandise with id gid://shopify/ProductVariant/45060060774721 does not exist.'

 

This item exists in my store and I don’t see anything wrong with it. Would there be any reason the storefront api wouldn’t see it?

 

thank you!!!

Let's solve problems together!
Accepted Solution (1)
g3misa
Shopify Partner
24 5 15

This is an accepted solution.

Figured it out.  It was something I did.  I have a custom Shopify App (using Admin API) that regularly updates the price of the products and every time it did an update, it changed the ProductVariantID of the products which wasn't intended.  I fixed it to make sure I passed the ProductVariantID when doing a productUpdate mutation.  Silly me.

Let's solve problems together!

View solution in original post

Replies 3 (3)

g3misa
Shopify Partner
24 5 15

When i query it using the Admin GraphQL API, it exists.  But using the Storefront GraphQL API, it is null.  This is really weird.

Let's solve problems together!
g3misa
Shopify Partner
24 5 15

I just realized that the ProductVariant ID that was used by the CartLineItem in my cart was non-existent.  I have no idea where this ProductVariant ID came from.  When doing a query for a productByHandle, I get this ProductVariant ID :

 

//query
{
  productByHandle(handle:"pacifica-beauty-ginger-root-10-in-1-hair-volumizer-spray-root-booster-for-hair-volume-lightweight-formula-for-all-hair-types-vitamins-antioxidants-sulfate-free-silicone-free-vegan"){
    variants(first:10){
      nodes {
        id
      }
    }
  }
}

//output
{
  "data": {
    "productByHandle": {
      "variants": {
        "nodes": [
          {
            "id": "gid://shopify/ProductVariant/45693587161409"
          }
        ]
      }
    }
  },

 

But looking at my Cart, this is the ProductVariant for that CartLineItem:

{
   "id":"gid://shopify/ProductVariant/45576784970049",
   "product":{
      "handle":"pacifica-beauty-ginger-root-10-in-1-hair-volumizer-spray-root-booster-for-hair-volume-lightweight-formula-for-all-hair-types-vitamins-antioxidants-sulfate-free-silicone-free-vegan",
      "title":"Pacifica Beauty, Ginger Root 10 In 1 Hair Volumizer Spray, Root Booster For Hair Volume, Lightweight Formula, For All Hair Types, Vitamins + Antioxidants, Sulfate Free, Silicone Free, Vegan",
      "id":"gid://shopify/Product/8337199399233"
   }
}

 

Has anyone ever encountered this discrepancy?

Let's solve problems together!
g3misa
Shopify Partner
24 5 15

This is an accepted solution.

Figured it out.  It was something I did.  I have a custom Shopify App (using Admin API) that regularly updates the price of the products and every time it did an update, it changed the ProductVariantID of the products which wasn't intended.  I fixed it to make sure I passed the ProductVariantID when doing a productUpdate mutation.  Silly me.

Let's solve problems together!