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.

savedSearchId on products or productVariants query.

savedSearchId on products or productVariants query.

ozzyonfire
Shopify Partner
52 2 19

Has anyone been able to get this to work? 

 

I have a very simple GraphQL query that I am attempting;

export const GET_PRODUCT_VARIANTS = gql`query getProductVariants($query:String $savedSearchId:ID) {
	productVariants(query:$query savedSearchId:$savedSearchId first:10) {
		edges {
			node {
        id
        title
        sku
        inventoryQuantity
        price
        compareAtPrice
        displayName
        product {
          productType
          vendor
        }
			}
		}
	}
}`;

export const GET_PRODUCTS = gql`query getProducts($query:String $savedSearchId:ID) {
	products(query:$query first:15 savedSearchId:$savedSearchId) {
		edges {
			node {
				id
        title
        productType
        vendor
        variants(first:5) {
          edges {
            node {
              id
              image {
                originalSrc
              }
              sku
              compareAtPrice
              price
            }
          }
        }
			}
		}
	}
}`;

 

When supplying a savedSearchId variable of "gid://shopify/SavedSearch/1999798337641" to either query I get an error back;

`Error: invalid savedSearchId`

 

I'm grabbing this savedSearchId from the productSavedSearches graphQL query. 

 

Does anyone know what I'm doing wrong?

Reply 1 (1)

ozzyonfire
Shopify Partner
52 2 19

It's been one year and this is still a problem. It's either a bug that hasn't been fixed or I'm still not seeing the solution...