Hi all,
Got a strange behavior going on with ProductVariants barcode filter.
{
productVariants(first: 1, query: "barcode:7613183629253") {
nodes {
id
}
}
}
returns nothing
"data": {
"productVariants": {
"nodes": []
}
},
doing the same thing for products
{
products(first: 1, query: "barcode:7613183629253") {
nodes {
id
variants(first:5){
nodes{
id
barcode
}
}
}
}
}
returns the variant with the barcode I was looking for in the first query
{
"data": {
"products": {
"nodes": [
{
"id": "gid://shopify/Product/14916263739771",
"variants": {
"nodes": [
{
"id": "gid://shopify/ProductVariant/55046994526587",
->"barcode": "7613183629253"<-
},
{
"id": "gid://shopify/ProductVariant/55046994559355",
"barcode": "7613183629239"
},
{
"id": "gid://shopify/ProductVariant/55046994592123",
"barcode": "7613183629260"
},
{
"id": "gid://shopify/ProductVariant/55046994624891",
"barcode": "7613183629277"
},
{
"id": "gid://shopify/ProductVariant/55046994657659",
"barcode": "7613183629246"
}
]
}
}
]
}
}
The point of this though is to get the variant id immediately. Interestingly enough this code works on another shop just fine, also using SKU instead of barcode also works…
Cheers,
Gary