I’m trying to escape single quote in graphql but it’s throwing error tried using blackslash to escape
basically I want to query
product title = D’Addario Test
or
tag = testtag
check below query for reference
{
products(first:2,query:"title:D\'Addario OR tag:testag", ){
pageInfo {
hasNextPage
hasPreviousPage
}
edges {
cursor
node {
id
title
}
}
}
}
Morek
June 14, 2021, 3:27pm
2
Hi @pawanthalia
Hope you’re having a great day!
Shopify supports the ability to escape special characters using backslash escaping. The current list of special characters is:
: \ ( )
So correct query is:
{
products(first: 2, query: "title:D'Addario* OR tag:testag") {
pageInfo {
hasNextPage
hasPreviousPage
}
edges {
cursor
node {
id
title
}
}
}
}
A prefix query will match documents containing terms that begin with a specified set of characters.
query=D’Addario*
This will search for all terms that begin with the prefix “D’Addario”. For example, “D’Addario Test”.
2 Likes
Morek
June 16, 2021, 2:13pm
3
Hi @pawanthalia
Hope you’re having a great day!
You’re welcome.
Please, mark the answer that helped you as an accepted solution . This would help others in the future who have the same problem and come across this thread.
Adding to the accepted answer, I’d like to share with you how to escape double quotes since it’s a bit tricky and took me a while to do it, here goes:
{
products(first: 2, query: """My name is "Bob" and this is my wife's car"""){
...
}
}
1 Like