Shopify Flow is an ecommerce automation platform that enables you to automate tasks and processes within your store and across your apps.
Good morning,
I have a requirement of displaying the number of orders by a customer in a specific timeframe e.g. last 3 months on the order invoice. It doesn't look like order printer has the customer.orders object to work with so I was looking for a workaround using Shopify Flow.
If I can get this number into the order note, I should be able to pull it into the invoice. I've tried the following code using the modify order note action:
{% for order in customer.orders %}
Date: {{ order.created_at }} <br>
{% endfor %}
However, when I save the flow and then click "Preview Workflow" I get an error saying "Your workflow can't be previewed. Fix any errors and try again."
Any assistance would be appreciated!
Hi @GenOnDev,
I'm pretty sure you cannot do that using Flow either. While liquid works in Flow, it only does so as long as you work with the available template variables, so your code won't run (which is causing your error message). I don't believe there is a way to list a customer's previous orders from an Order created trigger (you can only get the Customer order count, which is not helpful in your situation).
If there were such a way, you could probably do the second part of your query by pushing all past orders in an array with a timestamp for each, then assign a variable with the current date, minus your timeframe limit, and from there figure out how many items in your array are larger than your variable—which would be the number of orders within that timeframe.
You might be able to pull that kind of information using Zapier, or another 3rd-party connector. You could probably use a webhook when an order is created, then pull the customer ID, search the store for orders with that customer ID (since the customer.json doesn't supply that information by itself), and you could maybe sort of kinda get what you need(?). I'm really not sure Zapier's API connection allows for everything I mentioned, but it might be worth a shot.
If anything else comes to mind I'll drop you another reply here.
We 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, 2024We want to take a moment to celebrate the incredible ways you all engage with the Shopi...
By JasonH Oct 15, 2024