Shopify Flow is an ecommerce automation platform that enables you to automate tasks and processes within your store and across your apps.
I am trying to use flow to automate population of product metafields upon product creation.
I have a metaobject with a list of entries for each brand (it's a massive list, we stock hundreds of brands) and I want to auto populate the relevant product metafield with the metaobject entry that matches the product vendor of the product. I have set up the metaobject entries so that the Display Name matches the list of Product Vendors in shopify exactly.
The query I've been using in the Value on 'update product metafield' action in Flow is:
{% for metafields_item in product.metafields %}
{% if metafields_item.reference.Metaobject.displayName contains product.vendor %}
{{metafields_item.reference.Metaobject.id}}
{% endif %}
{% endfor %}
I thought the metaobject.id would return the entry where the display name matches product vendor but it doesn't seem to. Given I have a vendor list in the hundreds (and therefore the same number of metaobject entries) I need a solution that returns a specific entry based on the above condition rather than creating a flow for each vendor that returns a specific entry (i.e. I can't have a gid://shopify/Metaobject/123 in the value field)
The returned error on testing the above flow is:
Is there a solution to this problem?
That looks roughly correct. I would use a "Log output" action to test what data is available. I would remove that inner "if" statement and just output the variables like "product.vendor" and the displayName. Your condition appears to not be matching, but it's not clear why until you see the data.
The year-end shopping spree is around the corner! Is your online store ready for the ...
By JasonH Nov 10, 2024We recently spoke with Zopi developers @Zopi about how dropshipping businesses can enha...
By JasonH Oct 23, 2024A big shout out to all of the merchants who participated in our AMA with 2H Media: Holi...
By Jacqui Oct 21, 2024