I want to write a flow that checks to see if a product has an image associated with it.

Solved

I want to write a flow that checks to see if a product has an image associated with it.

BigLaCroix
Excursionist
33 0 8

Hi there,

CONTEXT:

I'm working on updating the website for my store, and I was looking for some clarity because there are multiple different options for Conditions. 

 

QUESTION:

The thing I'm trying to do in particular is have a workflow that activates upon a Product Variant Inventory Quantity Change (I know how to do this without issues), and when its activated, the condition that it checks is whether or not there are images associated with the product. I'm not sure which variables to use, or if there's a different way to make it work.

 

 

Product is the start, and then I wasn't sure if I wanted to use "featuredImage", "featuredMedia", "images", "media" or if there's a different variable I should use. I read the descriptions of each of the functions that stem from the four I listed above, but I just don't know which to use.

 

IDEAL END RESULT:

The end result of the flow will be based on this condition, and whether or not the product in question has any images attached to it or not, and would hide or add products to the website based on whether or not they have an image attached to it. 

 

I've made a text diagram of what I'm attempting to do if this description is a little confusing:

[FLOW TRIGGER: Product Variant Inventory Quantity Changed]

V V V 

[CONDITION {I don't know which variables to use}: Check to see if the product has images associated with it.]

V V V 

[ACTION: Hide or Publish product to website based on image condition]

-BigLaCroix
Accepted Solution (1)
paul_n
Shopify Staff
1160 143 275

This is an accepted solution.

Yeah, for that product page, you would want Product / images / URL.

 

I think Media is meant for a different use case and is a bit harder to understand, so no need to try that..

Paul_N | Flow Product 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 13 (13)

paul_n
Shopify Staff
1160 143 275

I can't tell what image you care about. I'd suggest using "log output" with those variables to see what URLs you get. Then use whichever matches the images you care about

Paul_N | Flow Product 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.
BigLaCroix
Excursionist
33 0 8

So when you go to a product page, it lets you add images. Our store stocks over 2000 items, and we haven't photographed all of them to put into the system. I also have other people who refuse to listen to me and learn how to correctly input products into our system. Basically, I want a program that will scrub our product listings without images from the website.

-BigLaCroix
paul_n
Shopify Staff
1160 143 275

I understand the use case, but which fields you want to use depends on which images you care about and I can't tell from the description. You can figure that out yourself by using Log output to see the URLs and comparing that with what you see in the UI. 

 

Generally, you should be able to check if an image URL is blank or missing (or if it contains some text) and then do something based on that (like unpublish). 

Paul_N | Flow Product 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.
BigLaCroix
Excursionist
33 0 8

I'm not concerned at all with URL's for images, because generally, our products are all photographed by me, so they're almost all uploaded by me. I am the source for 99% of all images on our website, however because I'm the 1 web staff for the whole company I work for, I'm only able to do so much by myself, and using Flow to automate has significantly made my job easier in some areas. 

 

What I want to know is if there is a condition in Flow that I can ask to check whether or not there are ANY images associated with the store and give me a binary result that says either "YES, There are images associated with this product", or "NO, this product has no images uploaded yet". I'm trying to avoid our website having product listings without images of any kind.

 

I manage a small retail business so I'm the only person able to work on the website's design, however there are people in some of our other locations who receive items from our suppliers and then need to add the products to our database, and generally they do so via product duplication. This can create errors in our online store and create listings for items that don't have product photographs yet, so my goal was to create a failsafe system to start to remove those items without images from the store. Maybe I'm misunderstanding something, or maybe this flow functionality doesn't exist yet, I'm not sure, but I feel like based on your answers that there's likely no way to make Flow check for this field:
Screenshot 2024-01-16 at 10.57.15 AM.jpg
I'm sorry if I'm misunderstanding or not explaining this well. I want a condition that will check to see if the above field is empty or not, and to give me a binary answer of yes or no, which I can then link to an action that either hides or publishes the product to our online store.

 

My original workaround idea was to create this condition:

Screenshot 2024-01-16 at 11.13.43 AM.png

 

My thought was that this MIGHT work as a workaround for what I'm looking for, but I wasn't sure if I was looking for the wrong thing, and I couldn't find a comprehensive explanation of what the differences between the images and media categories and the "featured" versions of them, no matter where I looked for it.

 

Let me know if this makes any sense at all, or if you think I'm trying to do something that is more work than it's worth. I'm just trying to save myself from having to do the busywork of checking every product in our catalog every day to see if there are new products that have shown up on the website that don't have images, and then unpublishing each and every single one of those entries. 

-BigLaCroix
BigLaCroix
Excursionist
33 0 8

I'm probably misunderstanding something here, but I've worked with shopify for about 5 years now for this small business, and as far as I understand, there's only one place for me to input photos for the website, and it's the image I posted first in my above message. I know there's a way to upload them via URL, which I use extremely infrequently, and there's a place to put different images based on variants, however we don't typically use that either. I'm not sure if that effects anything in this case. Again, my apologies if this is overly confusing or I have omitted context that is relevant to solving this, and thanks for hearing me out and trying to help me solve this. I really appreciate the help.

-BigLaCroix
paul_n
Shopify Staff
1160 143 275

The screenshot is helpful. I think you can only have 1 image there. The image you linked there is actually the image for a variant not a product. So you likely want to check if all of the product / variants / image / url exists or is not empty

 

The URL is just a mandatory field, so if the image does exist, the URL will be present. You could also use the ID field.

 

Just to reiterate ... you can double-check the data on that field by using the Log output action, using "Add a variable" and selecting that URL field from the data.

Paul_N | Flow Product 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.
BigLaCroix
Excursionist
33 0 8

Okay, let me provide some additional context, because I think we may be looking at slightly different things, but I've learned a lot from just asking all of this, and I'm pretty sure I can make the condition based on the info you provided above.

 

So I do believe you can add multiple photos to this field, as I've shown here (NOTE: some info is omitted for privacy sake of our designer's information on the internet, as well as sales information which shouldn't be relevant here):

 

Screenshot 2024-01-16 at 11.42.59 AM.png

 

So if I were to make the function in flow that I've been trying to make, I want it to check that field. I'm able to add images to specific variants below this, but this is (to my knowledge) just a general listing of all the images related to the item. This generally displays as a gallery on web pages.

 

I see that there are several functions here that may apply, and I understand that Flow requires specificity, or else the function created can be faulty, and can ultimately make issues for the functionality of the store, so I wanted to make sure I get this right before I create the function itself and apply it to our store and let it run.

 

Basically, I was assuming that I would need to use one of these two categories, and choose one of the functions that would be relevant, but I wasn't sure what the difference between the two categories was, and if one of them were specific to a part of Shopify I'm unfamiliar with.

 

[These are both under Product > Media] Let me know if I should be using a different category.

 

Screenshot 2024-01-16 at 11.56.08 AM.png

 

 

Screenshot 2024-01-16 at 11.56.15 AM.png

 

 

Just because I'm the inexperienced one here, I want to make sure I have this correct. You're saying that I should use:

Product > Variant > Image > URL and then use the "exists" condition, correct?

 

The only thing I have left to make sure is sorted out is whether or not we're looking at the variants category, or if there's a flow field for general images listed to a product. My question is why would I use variant here over just doing something like: 


Product > Images > URL > {Exists}

 

Thanks again for the help. You're saving me so much trial and error here.

-BigLaCroix
paul_n
Shopify Staff
1160 143 275

This is an accepted solution.

Yeah, for that product page, you would want Product / images / URL.

 

I think Media is meant for a different use case and is a bit harder to understand, so no need to try that..

Paul_N | Flow Product 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.
BigLaCroix
Excursionist
33 0 8

A quick update: This worked great for me

Here's an image of the Flow Process for anyone who has the same question as I do.Screenshot 2024-01-16 at 3.33.49 PM.png

-BigLaCroix
SGMuseum
Tourist
4 0 4

Hi Paul, I have a very similar use case, but I can't seem to get it working. I want to write a flow to unpublish from the online shop any products with no associated image.  I am attaching my condition definition, and also a screenshot of the flow log from the test product with no image. As you can see, the trigger does not appear to work. What am I doing wrong?

Screenshot 2024-04-16 at 9.41.50 AM.png

Screenshot 2024-04-16 at 9.39.55 AM.png

cybko
Shopify Partner
41 0 8

Do you have the rest of the flow? You could also reverse the logic like

cybko_0-1713277125764.png

and then have the action based on the otherwise condition

 

paul_n
Shopify Staff
1160 143 275

If there are no images, only the "Any/All/None" operator will be executed. The easiest way to do this is to use "none", which returns true if it's empty. The full condition would be "None of product / images is not empty or exists". You might have to switch the paths for your actions based on this.

Paul_N | Flow Product 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.
SGMuseum
Tourist
4 0 4

Thank you! That worked.