Skip to content
Advertisement

Display sum of item quantity in PDF export

I’m having issues displaying total quantity of all items at the bottom of my PDF export script I’m using with my WordPress site.

I’ve been able to display total quantity of each item using

JavaScript

Then I want to calculate the sum of all item quantities and show that as a single figure at the bottom of the table

Would I use

JavaScript

Advertisement

Answer

I hope you are showing each quantity via some loop, if yes then before loop define a variable like

JavaScript

Now change <td> code like this (inside loop):

JavaScript

And now in the end use this $sum variable to show total quantity.

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement