Making Shopify Functions query Dynamic

Hamza_Hussain
Shopify Partner
20 1 3

Hi guys I working on a Shopify App and I made a Shopify function to add discounts and this works fine but I want to make the "hasTags" part dynamic. The goal is to make text fields in the admin called product Tag and Customer Tags and it's values should come here in the product discount functions (Extension).

 

query RunInput {
  discountNode {
    metafield(namespace: "custom", key: "discount_value") {
      value
    }
  }
  cart {
    buyerIdentity {
      customer {
        amountSpent {
          amount
        }
        metafield(namespace: "custom", key: "customerDiscount") {
          value
        }
        hasTags(tags: ["customerDiscount"]) {
          hasTag
          tag
        }
      }
    }
    lines {
      merchandise {
        ... on ProductVariant {
          id
          product {
            id
            handle
            hasTags(tags: ["productDiscount"]) {
              tag
              hasTag
            }
          }
        }
      }
    }
  }
}
Honey_G_Hamza
Reply 1 (1)