Shopify flow get product data doesn't seem to be working

Solved

Shopify flow get product data doesn't seem to be working

carl-mgp
Shopify Partner
4 0 0

i have a work flow that i want to run where on trigger, it would query all products with a certain tag. to simplify testing, my flow looks like this. since there's no manual trigger of workflows, i set it up so that on create of a collection, it will query products then send an email with the ids if the queried products

 

shopify flow test query.jpg

 

the advanced query looks like this

 

shopify flow query subscription week 2.jpg

 

written out for copy-paste purposes

{
  products(first: 200, query: "tag:subscription-week-2" ) {
    edges {
      node {
        id
        title
        tags
      }
    }
  }
}

 

i used the Shopify GraphiQL App to test the query above and data is being returned. but when i run my flow, no data is being returned in the email. i simplified my query to then look like this

 

shopify flow query 100 products created_at reverse.jpg

 

for copy-paste purposes

{
  products(first: 100, sortKey: CREATED_AT, reverse: true) {
    edges {
      node {
        id
        title
        tags
        createdAt
      }
    }
  }
}

 

when i tested this in the graphiql app, it returned the products in reverse order of creation but in shopify flow, still no ids in the email being sent

 

i simplified the query further to look like this

shopify flow return 1 product.jpg

 

{
  products(first: 1) {
    edges {
      node {
        id
        title
        tags
        createdAt
      }
    }
  }
}

still no email sent with product ids

 

I set up another workflow that instead of sending an email, it will loop through the products and add a tag. the query is the same as above where it will just query one product and tag it

 

test shopify flow single product tag.jpg

 

the result showed that the for loop didn't process any data. the email was also empty. 

 

shopify flow tagging single product.jpg

 

i ran the same products(first: 1) query in graphiql and the returned product didn't have the test-shopify-flow tag. i queried graphiql for products with the test-shopify-flow tag and none were returned

 

test-shopify-flow-tag-check.jpg

 

Am i setting up queries correctly because it looks like the get product data action is bugged

 

thanks

Accepted Solution (1)

DaveMcV
Shopify Staff
104 31 29

This is an accepted solution.

Hi Carl-Mgp,

 

The field you're editing is what you'd typically write in the `query` argument for your first GraphQL example and only works using the Shopify Query Search Syntax. You aren't able to write full GraphQL queries in that text box. 

 

 

Using the `query` value from your first example, you should just need to add `tag:subscription-week-2` to get products with that tag.

 

Hope that helps!

DaveMcV | Flow Development Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.

View solution in original post

Replies 2 (2)

DaveMcV
Shopify Staff
104 31 29

This is an accepted solution.

Hi Carl-Mgp,

 

The field you're editing is what you'd typically write in the `query` argument for your first GraphQL example and only works using the Shopify Query Search Syntax. You aren't able to write full GraphQL queries in that text box. 

 

 

Using the `query` value from your first example, you should just need to add `tag:subscription-week-2` to get products with that tag.

 

Hope that helps!

DaveMcV | Flow Development Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
carl-mgp
Shopify Partner
4 0 0

oh i see i will test in a bit but the examples are confusing because they have full graphql queries on the bottom

 

edit: this was correct. thank you