Shopify Flow is an ecommerce automation platform that enables you to automate tasks and processes within your store and across your apps.
I would like to set up the following automation in the Shopify Flow-app. I can not manage to figure out how to do it. If it’s doable can someone please explain in detail how to do it?
Setting this up in Shopify Flow isn't straightforward as it doesn't directly support copying metafield URLs to the media section. However, you could use a combination of Flow and a custom app or script to achieve this.
If this fixed your issue, likes and accepting as a solution are highly appreciated
| Build an online presence with our custom-built Shopify Theme: EcomifyTheme
| Check out our reviews: Trustpilot Reviews
| We are Shopify Partners: EcomGraduates Shopify Partner
There aren't yet any events for when metafields are updated, so Flow can't build a trigger for that yet. Assuming that it's a product metafield, you might be able to instead use a Scheduled time trigger and then use "Get product data" to get recently updated products. You also cannot yet query products by metafields via the API, so you would need to track if you already updated a product somehow. The URL copy part can be done by calling "Send Admin API request" to update the product.
Thank you! For the Mutation i chose "productUpdateMedia".
However, I cannot figure out what to write in the "Mutation inputs". Can you please help me? What I would like to create (as you know) is that the URL from a specific product metafield is copied to the Media section.
Did you look at the linked docs? https://shopify.dev/docs/api/admin-graphql/2024-04/mutations/productUpdateMedia
for product id, you would enter productId: "{{ product.id }}"
Thanks! I am still not sure how I make it pick up the ”image/media-URL” from the Metafield? Should I write the name of the Mefafield somewhere?
(There are brackets and spaces in the Metafield name.)
Looking at your original use case, I don't think you are going to be able to copy the actual image from something external to that media. Assuming the media is already uploaded (or external but available via URL) and you want to copy a reference to your product, I think you want this mutation instead:
https://shopify.dev/docs/api/admin-graphql/2024-04/mutations/productCreateMedia
The mutation you have now is for updating existing media on the product
When I try that productId I get an error message. Please see the attached image.
If you are using Get Product Data, you need to loop over the returned products (maybe using For Each step). And then inside that loop with this action, click add a variable and find the product id
I decided to not use Get Product Data (since there seems to be a limit of 100 products).
Instead, I would like to update all products from their own metafield to their own media section. I start with a scheduled run. If possible I only want the media section to be updated when the automation is running, if the metafield includes a new URL, to avoid ending up with duplicate images in the media section.
Below you can see the automation, so far. I appreciate very much all your help, but unfortunately I don't understand how to set it up.
You have to use "Get product data" if you want to use product data in the automation. You can't use a {{ product.id }} because there is no product. To get around the 100 limit, typically you just run it multiple times (on a recurring schedule).
Okey. Now I have problem figuring out what to write in the Mutation input >
"originalSource": "XXXXXX"
Here I would like to link to the specific Metafield (which for every product contains different unique Image URL:s).
So instead of having an URL as the input in "originalSource", I would like to have the specific metafield as the input (which contains the image URL)
I have tried to use the data I can find in Settings > Custom data > Products > "Metafield 1" > The value I find in the field below the following text "Namespace and key"
When I tried the above I ended up with the follwing error message: "Mutation had user errors: "Image URL is invalid""
I understand that there ideally should be an URL, but what should I do if the image URL can be found in the metafield (for every product)
So how do I put the metafield as the input in "originalSource"?
Not sure what type of metafield you have, so it depends on that. If it's just a URL type on the product, the syntax would be something like:
{{product.imageUrl.value}}
Where imageUrl is an "alias" generated by Flow based on your metafield's name. To add that to a workflow, you would choose "Add a variable" and then follow this screen:
Thanks. I will use the flow for all published products when everything seems to be working, but now i firstly will see if it can work as I would like to, for one of the products.
So I think I have to modify the syntax below(?):
{{product.imageUrl.value}}
I tried by replacing product with that products ID (https://shopify.dev/docs/api/admin-graphql/2024-01/scalars/ID), and also only the products unique figures. In the picture below I use the products ID and imageURL from the examples, but I have of course tried with my actual values.
As you can see above I am not able to get it to work.
I use a single line text product metafield.
Hey Community! As we jump into 2025, we want to give a big shout-out to all of you wh...
By JasonH Jan 7, 2025Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024