Graphql get all products to which a discount applies, empty result

atielking
New Member
5 0 0

Hello! I am using this GraphQL query to get the names of all products to which a specific discount applies. However, I am seeing an empty result when I shouldn't be.

 

I can look up the specific discount code and verify that it is only valid for a handful of products by navigating to a URL like this: https://tigerlily-perfume.myshopify.com/admin/discounts/X.

 

So, I'm wondering if there is a bug in this part of the GraphQL API?

 

Thanks!

 

 

 

{
  codeDiscountNodes(first: 1, query:"status:active AND ends_at:>%s AND ends_at:<%s") {
    edges {
      node {
        codeDiscount {
          __typename
          ... on DiscountCodeBasic {
            endsAt
            customerGets {
              items {
                __typename
                ... on DiscountProducts {
                  products(first:1) {
                    edges {
                      node {
                        handle
                      }
                    }
                  }
                }
              }
            }
            customerSelection {
              __typename
              ... on DiscountCustomers {
                customers {
                  email
                  displayName
                }
              }
            }
          }
        }
      }
    }
  }
}

 

 

 

 

Replies 0 (0)