I’m trying to display the number of unfulfilled orders our store currently has ahead of a customer who might be placing an order.
It should work out the number of orders with the status unfulfilled there are at the time they are browsing and show the number.
The code I have been testing is as follows but it is returning 0 orders everytime, it should be 77.
{% assign unfulfilled_orders = 0 %}
{% for order in orders %}
{% if order.fulfillment_status == 'unfulfilled' and order.created_at <= 'now' %}
{% assign unfulfilled_orders = unfulfilled_orders | plus: 1 %}
{% endif %}
{% endfor %}
The number of unfulfilled orders as of {{'now' | date: '%Y-%m-%d'}} is {{unfulfilled_orders}}.