A Shopify theme developer couldn’t display customer orders in Liquid: customer.orders_count always returned 0 despite placing test orders via the Bogus payment gateway. The goal was to build a customer orders page using the Order object in Liquid.
Key guidance:
Ensure you are logged into a customer account when checking customer-related objects.
Use customer.orders.size to detect orders and iterate over customer.orders to render details.
Working solution (via example code):
Check if customer.orders.size > 0, then loop through customer.orders and output fields such as order.id, order.email, order.name, and order.total_price.
Outcome:
The iteration approach using customer.orders.size worked and displayed orders correctly.
customer.orders_count continued to return 0; the thread did not resolve why, but the practical display issue was solved using the loop.
Status: Resolved for displaying orders; underlying discrepancy with orders_count remains unanswered.
Summarized with AI on December 12.
AI used: gpt-5.
Hi, I’ve built a Shopify theme from scratch and am currently working on designing the customer orders page. I’ve placed test orders using the Bogus payment gateway, but when I try to display the orders using Liquid (e.g., customer.orders_count), it always shows 0.
Could you guide me on how to properly work with the Order object in Liquid?
Did you login customer account when checking object for it?
And try ‘customer.orders.size’. For example code:
{%- if customer.orders.size > 0 -%}
{%- for order in customer.orders -%}
{% comment %} show code order here {% endcomment %}
{%- endfor -%}
{%- endif -%}