Error: "Query has complexity of 31, which exceeds max complexity of 30"

i have a error when write discont shipping fuction “Error while updating drafts: Query has complexity of 31, which exceeds max complexity of 30”. i have found every way, can you guide me how to fix it, i don’t want to lose any data, and expand more later, thank

this is my code:

query RunInput(
$collectionIds: [ID!]
$productTags: [String!]
$customerTags: [String!]
) {
cart {
lines {
quantity
merchandise {
… on ProductVariant {
weight
weightUnit
sku
product {
id
inCollections(ids: $collectionIds) {
isMember
}
hasTags(tags: $productTags) {
hasTag
}
productType
}
}
}
sellingPlanAllocation {
sellingPlan {
recurringDeliveries
}
}
}
buyerIdentity {
purchasingCompany {
company {
id
}
}
customer {
id
hasTags(tags: $customerTags) {
hasTag
}
amountSpent {
amount
}
}
}
attribute {
key
value
}
cost {
subtotalAmount {
amount
}
totalAmount {
amount
}
}
deliveryGroups {
deliveryAddress {
countryCode
}
deliveryOptions {
handle
title
cost {
amount
}
}
}
}
presentmentCurrencyRate
discountNode {
metafield(
key: “function-configuration”
namespace: “$app:shipping-discount”
) {
value
}
}
}

It sounds like you’re hitting performance limits and you’ll want to optimise the query. Make sure you only query the fields you absolutely need. For example, if you don’t need weight or weightUnit , remove them.

Another strategy would be to break the query into smaller queries that each stay within the complexity limit. For example, you can query cart.lines and cart.buyerIdentity separately.

okay but how do I actually perform multiple queries from one run.grahql file? I am trying to achieve this in a shopify function and can’t seem to find a way to pass multiple queries into run.js