What's your biggest current challenge? Have your say in Community Polls along the right column.

discountNode always giving null

discountNode always giving null

ibosNafee
Shopify Partner
1 0 1
query RunInput {
  cart {
    lines {
      id
      quantity
      merchandise {
        __typename
        ... on ProductVariant {
          id
        }
      }
    }
  }
  discountNode {
    metafield(
      namespace: "$app:product-discount"
      key: "function-configuration"
    ) {
      value
    }
  }
}

I have created an extensions named product-discount to give automatic discounts based on products on cart. The extension gave me run.js and run.graphql files. 

 

I have created an discount using GraphiQL App. Also I am getting that value using that app.

 

{
          "id": "gid://xxx",
          "metafields": {
            "edges": [
              {
                "node": {
                  "id": "gid://xxx",
                  "value": "{\"value\":\"42\"}",
                  "namespace": "app--xx--product-discount"
                }
              }
            ]
          },
          "discount": {
            "startsAt": "2022-06-22T00:00:00Z",
            "endsAt": null
          }
        }

But while I am running the code and debug, the discountNode always giving null.
What could be the problem?

Replies 0 (0)