I have a Shopify discount function which adds Automatic discount to Specific product or collection. I am trying to display Discounts on product page via Theme Extention.
My discount function is working fine, which adds discounts. After adding discount query which I gave to graphql is following:
query GetDiscountMetafields{ discountNode(id: "gid://shopify/DiscountAutomaticNode/1454430060740") { metafields(namespace: "volume-discount", first: 10) { edges { node { key value } } } } }
And following is the response which I get
{ "data": { "discountNode":
{ "metafields": { "edges": [ { "node":
{ "key": "function-configuration", "value": "{\"tiers\":[{\"quantity\":2,\"percentage\":10},
{\"quantity\":3,\"percentage\":20}],\"products\":
[\"gid://shopify/Product/8098699772100\"],\"collections\":[],\"productCollections\":{}}" } } ] } } }
Which is as expected and completely fine. But when I try to access these values via theme extention it returns “null”
{{product.metafields['volume-discount.function-configuration'] | json}}
This code snippet should return Value as per my query result above but it shows “null” only.
Can someone please help me?