How to get item count number from customer's order

Hi,

I am working on Shopify notification email, and I want to know how to get item count number from customer’s order. For example, when customer placed an order with 5 items, how can I get the number “5” ?

I found there is “shippable_items_count” and “fulfillment.item_count” but these are not the one I am looking for.

When customer order 5 items, but 1 item is sold out, then shippable_items_count would be 4. Is there any way I can get the number 5, the original item count from customer’s order?

Thanks in advance,

Hi @jayhj ,

My solution might be the best, but I would say try to get the length of the array,

Try to find a forloop, and for my notification order code, the code below does call the order items.

{% for line in subtotal_line_items %}

Below the forloop code, you can call the total items by adding the code below.

{{ forloop.length }}

I should be able to use this subtotal_line_items.length but for some reason it does not work.

Hi @jayhj ,

You can use following code, it will work fine:

{{ subtotal_line_items.size }}

Hope it helps!

1 Like