App reviews, troubleshooting, and recommendations
Hi community,
Shopify allows " symbols in SKU:
But when I try to search for that SKU using GraphQL Admin API, it looks like that it does not allow " symbol in search condition:
When it works without " symbol:
Is there an elegant way to avoid this problem in general and using Remix template?
Very much appreciate any help.
Solved! Go to the solution
This is an accepted solution.
You don't need to wrap the string after the sku in double quotes so this query should work:
query myQuery {
productVariants(first: 1, query: "sku:AMS\"FG1WHCM") {
edges {
node {
id
title
}
}
}
}
And for what it's worth you can also use unicode where " translates to \u0022 resulting in:
query myQuery {
productVariants(first: 1, query: "sku:AMS\u0022FG1WHCM") {
edges {
node {
id
title
}
}
}
}
You could replace any " in the original string with \" or \u0022 explicitly, or find a more fully fledged solution in whatever programming language or tool you're using to make this request!
And finally if you really prefer to have quotes around the query you can just use single quotes to avoid the escaping nightmare:
query myQuery {
productVariants(first: 1, query: "sku:'AMS\"FG1WHCM'") {
edges {
node {
id
title
}
}
}
}
All three of the above gave me the same results when testing on my shop!
This is an accepted solution.
You don't need to wrap the string after the sku in double quotes so this query should work:
query myQuery {
productVariants(first: 1, query: "sku:AMS\"FG1WHCM") {
edges {
node {
id
title
}
}
}
}
And for what it's worth you can also use unicode where " translates to \u0022 resulting in:
query myQuery {
productVariants(first: 1, query: "sku:AMS\u0022FG1WHCM") {
edges {
node {
id
title
}
}
}
}
You could replace any " in the original string with \" or \u0022 explicitly, or find a more fully fledged solution in whatever programming language or tool you're using to make this request!
And finally if you really prefer to have quotes around the query you can just use single quotes to avoid the escaping nightmare:
query myQuery {
productVariants(first: 1, query: "sku:'AMS\"FG1WHCM'") {
edges {
node {
id
title
}
}
}
}
All three of the above gave me the same results when testing on my shop!
This looks great. Thank you!
I have to surround a SKU with " because a SKU may have a space besides " symbol:
So looks like the third option works for me.
But there is an issue with the third option - it does not allow ' symbol 😅
Because I am construction a search condition with provided SKUs, I do not know exactly what is inside:
const queryCondition = batch
.map(
(id: any) =>
`${filterCheckedValue === "sku" ? "sku" : "barcode"}:\\"${id}\\"`
)
.join(" OR ");
So I am not sure whether there is a universal solution for any allowed for SKUs symbols.
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025