How can I pass input variables to Shopify QL Queries?

How can I pass input variables to Shopify QL Queries?

basima25z
Shopify Partner
6 0 0

I am trying to pass in a product ID in order to get the net_sales using ShopifyQL.

Currently I have:

 

 

 

query getNetSales($id: ID!) {
  shopifyqlQuery(query: "FROM products SHOW sum(net_sales) WHERE product_id = id") {
    __typename
    ... on TableResponse {
      tableData {
        unformattedData
        rowData
        columns {
          name
          dataType
          displayName
        }
      }
    }
    parseErrors {
      code
      message
      range {
        start {
          line
          character
        }
        end {
          line
          character
        }
      }
    }
  }
}

 

 

 

 

It seems to me that you can't pass in a variable to shopifyqlQuery.

Is there a way I can pass in the product id / how can you deal with variables in shopifyQL? Can I pass in a whole query and append the id to it?

Thank you in advance. 

Replies 0 (0)