Order Printer - I simply need a sum of Products Ordered

Jason_Lee6
Tourist
8 0 3

Hi, I am trying to get my Order Printer template to display the TOTAL Quantity of items ordered. Have tried line.item_count to no success. What do I need to add to this section of code?

<table class="table-tabular" style="margin: 0 0 1.5em 0;">
  <thead>
    <tr>
      <th>Quantity</th>
      <th>Item</th>
      {% if show_line_item_taxes %}
      <th>Taxes</th>
      {% endif %}
      <th>Price</th>
    </tr>
  </thead>
  <tbody>
    {% for line_item in line_items %}
      <tr>
        <td>{{ line_item.quantity }} x</td>
        <td><b>{{ line_item.title }}</b></td>
        {% if line_item.tax_lines %}
          <td>
            {% for tax_line in line_item.tax_lines %}
              {{ tax_line.price | money }} {{ tax_line.title }}<br/>
            {% endfor %}
          </td>
        {% endif %}
        <td>{{ line_item.price | money }}</td>
      </tr>
    {% endfor %}
  </tbody>
</table>

Thank you.

Jason

Kasimir
Shopify Partner
385 0 63

Hello Jason,

This would not really be a build in feature but its easily archievable.

Put this somewhere on the top of the template:

{% assign totalProductsOrdered = 0 %}
{% for line_item in line_items %}
    {% assign totalProductsOrdered = totalProductsOrdered | plus: line_item.quantity %}
{% endfor %}

And then you can access the count anywhere under the snippet by using:

{{ totalProductsOrdered }}

Kasimir

"Good design is good business"
Jason_Lee6
Tourist
8 0 3

Hello Kasimir. You are so kind. Thank you. It helped immediately. Sincerely, Jason

Ming_cxm
New Member
1 0 0

Hi,

 

I would like to loop through all the orders and get a product list with summarised products in total group by products, could anyone give me some tips? Thanks!

 

 

0 Likes
butterflyersinc
Tourist
4 0 10

Worked for me too! The Shopify "Gurus" didn't help, but you did! Maybe they should hire you... Thanks a bunch!

0 Likes
Sandoitchii
New Member
1 0 0

My store accepts tips.  When I print the packing slip with the count of total products, it includes Tip in that count.  Is there a way to remove Tip as a line item and remove it from the total count?

0 Likes
Ranimix
New Member
2 0 0

Hi,

I want to be able to select all my outstanding orders to loop through them and print out the product name and the total number of orders for each product. This will allow me to easily do the packing after all the items are picked together. How can I create such template with Order Printer or is there aother app that can do this for me?

 

Thanks

0 Likes
Bhuvanesh_Mille
Shopify Partner
4 0 0

It was not working for me for me but I figured it out! I only ever saw a total of zero, but I needed to make this change and then it worked.

 

{% assign totalProductsOrdered = 0 %}
{% for line_item in line_items_in_shipment %}
    {% assign totalProductsOrdered = totalProductsOrdered | plus: line_item.shipping_quantity %}
{% endfor %}

 

My packing slip template reads {% for line_item in line_items_in_shipment %} so that's the first change (on line 2 above).

Then I wanted to show the total shipped (not total ordered) so I used plus: line_item.shipping_quantity in the third line because my template reads {{ line_item.shipping_quantity }} of {{ line_item.quantity }} 

Hope this helps others!

0 Likes