discountNode always giving null

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?

1 Like