I have a Query i have been using, but today i have noticed and issue where the SKU appears to be searching a wild card opposed to just the SKU Field. I suspect its the format of my query, as if i modify it slightly i can make it work correctly.
GraphQL Query:
query ($first: Int, $sku: String)
{ productVariants(first: $first, query: $sku) {
edges {
node {
title
id
sku
product {
title
}
inventoryItem {
id
inventoryLevels(first: 3) {
edges {
node {
id
available
location {
id
name
address {
city
}
}
}
}
}
}
}
}
}
}
Variables
{
"first": 5,
"sku": "555"
}
So when searching 555 SKU its actually returning products that have 555 in the body_html.
If i edit the query to have the SKU Embedded then it works, but i need to use it with a variable, maybe its my poorly formatted query.
Edited the Query as follow to embed the sku in the query and it works.
query ($first: Int)
{ productVariants(first: $first, query: "sku:555") {
edges {
node {
title
id
sku
product {
title
}
inventoryItem {
id
inventoryLevels(first: 3) {
edges {
node {
id
available
location {
id
name
address {
city
}
}
}
}
}
}
}
}
}
}
How does one format it so it shows like:
query: "sku:"$sku