Show unfulfilled order total to customer/visitors of site

Topic summary

Goal: show customers/visitors the current count of unfulfilled orders on the storefront.

  • The author provided a Shopify Liquid loop over orders, counting those with fulfillment_status == ‘unfulfilled’ and created_at <= ‘now’, but it always returns 0 instead of the expected 77.

  • Key terms: Liquid (Shopify’s templating language), filter (functions applied to variables, e.g., date), fulfillment_status (order shipping state), created_at (order creation timestamp).

  • Feedback: ‘now’ typically works only when used with a filter. Store the current date using the date filter (e.g., assign a variable with “‘now’ | date: ‘%Y-%m-%d’”) and ensure its format matches how order.created_at is presented before comparison.

  • Action item: adjust the code to define a properly formatted ‘now’ variable and compare like-for-like date formats.

  • Outcome: no confirmed fix yet; the thread remains open with the suggested approach pending validation.

Summarized with AI on January 29. AI used: gpt-5.

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}}.

hey, Benpellwall. I think the validation order.created_at probably shouldn’t work, as ‘now’ usually only works with the filter. You can try to store {{ 'now | date: ‘%Y-%m-%d’ }} in a variable and, then, see if it matches the way that order.created_at presents its date