All things Shopify and commerce
I am using the following code to count the orders f a counter at additional scripts for checkout
{% assign customer = customer %}
{% assign order_count = 0 %}
{% for order in customer.orders %}
{% assign order_count = order_count | plus:1 %}
{% endfor %}
But I am getting the value 0.
I have orders under that account. Can someone please let me know how to get the actual value.
Hi,
You can use the orders_count property on the customer object.
https://shopify.dev/api/liquid/objects/customer#customer-orders_count
Try this one in your script
orderCount: "{{ checkout.customer.orders_count }}"
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025