App reviews, troubleshooting, and recommendations
I am developing an application for Shopify that applies automatic volume discounts based on the product metafileds and the tag the user has.
Everything works correctly, the problem is that when I enter all the metafileds and tags of interest I get this error.
Validation errors
targeting.0.input_query: Query has complexity of 31, which exceeds max complexity of 30
Many people recommend reducing the cost of the query but I don't know how to do it. Can you help me out?
query Input {
cart {
buyerIdentity {
customer{
hasTags(tags : ["star","vip"]){
hasTag
tag
}
}
}
lines {
id
quantity
cost{
prezzo: amountPerQuantity{
amount
}
prezzoDiConfronto: compareAtAmountPerQuantity{
amount
}
}
merchandise {
__typename
... on ProductVariant {
id
product {
star: metafield(namespace: "custom", key: "star") {
value
}
vip: metafield(namespace: "custom", key: "vip") {
value
}
dataStartvip: metafield(namespace: "custom", key: "datastart_vip") {
value
}
dataEndvip: metafield(namespace: "custom", key: "dataend_vip") {
value
}
dataStartstar: metafield(namespace: "custom", key: "datastart_star") {
value
}
dataEndstar: metafield(namespace: "custom", key: "dataend_star") {
value
}
}
}
}
}
}
discountNode {
metafield(namespace: "volume-discount", key: "function-configuration") {
value
}
}
shop {
localTime {
date
}
}
}
Solved! Go to the solution
This is an accepted solution.
Each metafield you fetch adds 3 to your query complexity. I recommend storing a JSON object in a single metafield, rather than having 6 separate metafields on your product.
This is an accepted solution.
Each metafield you fetch adds 3 to your query complexity. I recommend storing a JSON object in a single metafield, rather than having 6 separate metafields on your product.
Hey Community! As we jump into 2025, we want to give a big shout-out to all of you wh...
By JasonH Jan 7, 2025Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024