Total Quantity in POS

How to calculate total quantity in POS ?

For eg:

It would be greatly appreciated if anyone help me to achieve this.

Hi all,

Any suggestions regarding the above mentioned query ?

Do you want to show the total qty in Print Format? Then create a customized Print Format showing the total qty.

Thanks for the reply @nabinhait


Thanks for the suggestion. Would you share any specific link to achieve this.

Hi @sethu

Kindly check existing print format Point of Sale


Thanks for the reply @rohit_w. Hope this link will help me. :smiley:

Hi @rohit_w I tried this but doesn’t work

Total Qty: {{ doc.items|sum(attribute='qty') }}

Hi @sethu

The POS print format type is JS, try below code

	{% var sum=0.0 %}
	{% for item in items %}
		{% var sum = sum+item.qty %}
		{{ sum }}
	{% endfor %}
1 Like

Hi @rohit_w

Thanks for your reply. And i tried the above mentioned code but it got error. “Encountered unknown tag ‘var’.”

Any help would be greatly appreciated.

Hi @sethu

We’ve fixed the issue, soon we’ll release it

1 Like

Hi @rohit_w

After your fixes, i have updated the code as you mentioned but still i din get the correct value in “Total qty”. And kindly see the image for your reference.

Any suggestions would be very helpful for me.


@nabinhait @rohit_w


I think total quantity in POS Invoice should be standard and should available from master branch. Isn’t on POS Invoice for sure it is must needed for everyone?

Hello Rohit

How do we put basket quantity total on PoS Screen?

Cashiers need to know how many items they have scanned so they can count before bagging the goods.


Hi - is there a solution to having qty in basket quantity total?

Create a new field in your mother docytype to calcualte your quantity.

Child table = the name of your child table
new_field = this is your new created field.

try this code using custom script

frappe.ui.form.on("child table", "quantity", function(frm, cdt, cdn) {
	 new_field = 0;
	 $.each( of your table || [], function(i, d) {
	 new_field += flt(d.quantity);
	frm.set_value("new_field ", new_field );