Shopify Flow is an ecommerce automation platform that enables you to automate tasks and processes within your store and across your apps.
Howdy!
I need help in creating Shopify Flow.
What I did
1. Add custom code that allows the customer to add a custom Gift Note on Checkout pages. I did use the cart.attributes feature, it's working perfectly right now.
2. Here's the results in Order Details page, it shows the custom Cart attributes.
Issues: The Flow doesn't trigger
I did create a Custom Flow that will add the submitted data to Google Spreadsheet. Here's my conditions.
I think there's something wrong with my Custom Attributes conditions. Can someone please verify if the conditions are correct. Please check below.
Any help is appreciated! Thanks!
Any one please help me on this?
Hi,
Note that you don not need to prefix these with "attributes", and that the keys may be case sensitive.
Alternatively, you can create a single condition where all of the custom attribute keys must match one of specified keys, like so (if you don't expect any other attributes to be available):
This is also something I'm interested in. I cannot get my flow to work using customAttributes
This is 3 years later for a reply but if anyone is having this issue it is worth mentioning the 2023 solution.
@evaldas_92 is 100% correct, When using a condition for custom attributes, you will loop over them. the key is JUST the name of the attribute and NOT attribute[key]. If you are unsure, you can see the key's name when you click on the custom attributes on the order.
Now the main reason I posted this is that if you are trying to USE values in the order attributes, you need to know that Shopify Flow uses the GraphQL api. So reference: https://shopify.dev/docs/api/admin-graphql/ for the names in your code.
Secondly, you can use full liquid code in there to set a variable.
So if you can use
{%- liquid
assign theAttributeYouCareAbout = "defaultValue"
for attribute in order.customAttributes
if attribute.key == "theAttributeKey"
assign theAttributeYouCareAbout = attribute.value
break
endif
endfor -%}{{ theAttributeYouCareAbout }}
I have used this code and replaced the default value as well as the name of the attribute key and by storage variable in a working shopify flow.
Use as you see fit!
In the worst case if you can't sort it out using shoify flow, you can always create a custom private app with a webhook and write it in your language of choice (Python, Javascript..etc)
Thank you both for posting this solution. To piggy back on this, is there a standard way to define the key for custom attributes when an underscore or dash is not used between words? For example, we have a custom attribute named "Customer Type" that we would like to add to a metafield using a flow. Does this need to be changed to something like "Customer_Type" in order to reference the key, in which case the full variable to reference this custom attribute would be {{order.customAttributes.Customer_Type}}, or is there another way to reference this without adding the underscores and dashes? And if there is, how can one determine the correct Key for a custom attribute with spaces?
I'm interested in excluding the dash and underscores because this is a field that the customer will see during checkout and on the invoice, and it looks less professional when the dashes and underscores have to be sued.
Thank you for any additional light someone can shed on this!
In Flow, you cannot access custom attributes like: {{order.customAttributes.Customer_Type}}
If you look at the code just above your post, it loops over custom attributes and checks the key. The same approach is currently used for metafields.
No need to loop, the value of `Customer_Type` could be accessed using the `where` and `map` filters:
{{ order.customAttributes | where: 'key', 'Customer_Type' | map: 'value' }}
Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024In today’s interview, we sat down with @BSS-TekLabs to discuss practical strategies for...
By JasonH Nov 13, 2024The year-end shopping spree is around the corner! Is your online store ready for the ...
By JasonH Nov 10, 2024