I want to get collection details while I have array of collection ids which I got from metaobjects collection list.
I am using this code in loader function
const id_= "gid://shopify/Collection/409408995579";
const collection_id_data = await storefront.query({
data: {
"query": COLLECTION_QUERY_ID,
"variables": {"id": id_,},
},
})
const COLLECTION_QUERY_ID = `query GetCollection($id: ID!) {
collection(id: $id) {
handle
}
}`
I ALSO TRIED THIS CODE TOO:
const id_= "gid://shopify/Collection/409408995579"
const abcd = await storefront.query({
query: SINGLE_COLLECTION,
variables: { id_ },
});
const SINGLE_COLLECTION = `query ($id_ : ID!) {
collection(id: $id_) {
handle
}
}`
but this cause following error: TypeError: string.replace is not a function at minifyQuery at Object.query
libratry versions I am using :
"@remix-run/react": "2.1.0",
"@shopify/cli": "3.50.0",
"@shopify/cli-hydrogen": "^6.0.0",
"@shopify/hydrogen": "^2023.10.0",
"@shopify/remix-oxygen": "^2.0.0",
"graphql": "^16.6.0",
"graphql-tag": "^2.12.6",
What I want to achieve is to get collection details by using its ids which I have in an array. I want to pass ids to query in loop to get all data collections.