What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Re: How to use metafield value/ dynamic value on hasAnyTag

Solved

How to use metafield value/ dynamic value on hasAnyTag

ifat802
Shopify Partner
9 0 0
query Input {
  cart {
    buyerIdentity {
      customer {
        hasAnyTag(tags: ["vip"])
      }
    }
  }
  discountNode {
    metafield(namespace: "$app:order-discount", key: "function-configuration") {
      value
    }
  }
}

Here hasAnyTag has a hardcoded tag vip. 
I want to use dynamic tags here so that customers can set their own tags.
Can I use the Metafield value here?

Iftakhar
Accepted Solution (1)

Liam
Community Manager
3108 344 895

This is an accepted solution.

Hi Ifat802,

 

Have you looked into using variables in input queries - it sounds like this is what you'll need for using metafields in this context.

Hope this helps!

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

View solution in original post

Replies 3 (3)

Liam
Community Manager
3108 344 895

This is an accepted solution.

Hi Ifat802,

 

Have you looked into using variables in input queries - it sounds like this is what you'll need for using metafields in this context.

Hope this helps!

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

ifat802
Shopify Partner
9 0 0

Thanks, @Liam. I have figured out the solution. 

Iftakhar
Liam
Community Manager
3108 344 895

Great to hear!

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog