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.
By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024Thanks to everyone who participated in our AMA with 2H Media: Marketing Your Shopify St...
By Jacqui Sep 6, 2024