I am having trouble searching for products in my store using the storefront GraphQL query. I have tried multiple variations, such as not including “title: …”, using “SKU: …”, adding those parameters, using “*”, and even changing the API version from 2021 to 2024. Despite these efforts, I am still unable to retrieve the products I need.
Here is my query:
export const searchProductPayload = (
curr_store: StoreDocument,
query: string,
) => {
const shop = curr_store.domain.split(".")[0];
const payload = {
query: `
query ($query: String!) {
products(first: 1, query: $query) {
edges {
node {
id
title
variants(first: 100) {
edges {
node {
id
sku
title
price {
amount
}
image {
url
}
}
}
}
}
}
}
}
`,
variables: {
query: `${query}`,
},
};
return {shop, payload};
};
It works for certain items but when I try to search for a specific problem (by title or SKU) I get an empty array, even though the product is live and available “Live Free Or Die Women’s T-Shirt” (AJ-TS-499-W-LIVEFREE-BLK-S), yet the male version is displayed:
Any suggestions on why this would not be populating the women ts? I read on several posts individuals are having issues with querying, but I am not sure if the problem is known, persisting, or an error on my end while querying.
