# How to divide and multiple in HTML template

**URL:** <https://forum.manager.io/t/how-to-divide-and-multiple-in-html-template/3541>\
**Category:** Uncategorized\
**Created:** [August 12, 2015, 8:59pm UTC](https://forum.manager.io/t/how-to-divide-and-multiple-in-html-template/3541 "2015-08-12T20:59:46Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![jankiah](https://avatars.discourse-cdn.com/v4/letter/j/45deac/32.png) [@jankiah](https://forum.manager.io/u/jankiah)\
**Post date:** [August 12, 2015, 8:59pm UTC](https://forum.manager.io/t/how-to-divide-and-multiple-in-html-template/3541/1 "2015-08-12T20:59:47Z")

</div>

I’m want to customize my sales invoice. I can minus 2 variables eg. below

{% for tax\_component in tax\_components %}  
{% assign ttotal = tax\_component.amount %}  
{% endfor %}

{% assign sstotal = subtotal | minus:ttotal %}

I can also add eg.

{% assign sstotal = subtotal | plus:ttotal %}

How do i divide and multiply. I tried using "divide, div, division, / " but it does not work.

Please advise.

---

<div class="post-metadata">

**Author:** ![Kal](https://avatars.discourse-cdn.com/v4/letter/k/9de053/32.png) [@Kal](https://forum.manager.io/u/Kal)\
**Post date:** [August 13, 2015, 12:36am UTC](https://forum.manager.io/t/how-to-divide-and-multiple-in-html-template/3541/2 "2015-08-13T00:36:34Z")

</div>

`times`

```
{{ 5 | times:4 }} #=> 20

```

`divided_by`

```
{{ 10 | divided_by:3 }} #=> 3

```

> **[Liquid for Designers · Shopify/liquid Wiki](https://github.com/Shopify/liquid/wiki/Liquid-for-Designers)**
>
> Liquid markup language. Safe, customer facing template language for flexible web apps. - Liquid for Designers · Shopify/liquid Wiki

---

<div class="post-metadata">

**Author:** ![jankiah](https://avatars.discourse-cdn.com/v4/letter/j/45deac/32.png) [@jankiah](https://forum.manager.io/u/jankiah)\
**Post date:** [August 13, 2015, 7:18am UTC](https://forum.manager.io/t/how-to-divide-and-multiple-in-html-template/3541/3 "2015-08-13T07:18:02Z")

</div>

Thanks Kal. Is there a rounding (2 decimal places) method for divided\_by. It’s currently giving me eg.  
20.1394656778. I want it to be rounded to 20.14.

Appreciate the help!

---

<div class="post-metadata">

**Author:** ![lubos](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.manager.io/lubos/32/62798_2.png) [@lubos](https://forum.manager.io/u/lubos)\
**Post date:** [August 13, 2015, 7:22am UTC](https://forum.manager.io/t/how-to-divide-and-multiple-in-html-template/3541/4 "2015-08-13T07:22:55Z")

</div>

For rounding, you can use `round` filter.

```
{{ 4.5612 | round: 2 }}

```

will output:

```
4.56

```

---

<div class="post-metadata">

**Author:** ![jankiah](https://avatars.discourse-cdn.com/v4/letter/j/45deac/32.png) [@jankiah](https://forum.manager.io/u/jankiah)\
**Post date:** [August 13, 2015, 6:40pm UTC](https://forum.manager.io/t/how-to-divide-and-multiple-in-html-template/3541/5 "2015-08-13T18:40:13Z")

</div>

Thanks lubos,

I’ve copied your example in the line of code below and it’s still displaying 4.5612 on the sales invoice. I’m not sure what could be wrong.

 ![](https://us1.discourse-cdn.com/flex019/uploads/manager1/original/2X/6/61cc0cec2d0bcaccd716f7a647516f67c69d69ea.png)

---

<div class="post-metadata">

**Author:** ![lubos](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.manager.io/lubos/32/62798_2.png) [@lubos](https://forum.manager.io/u/lubos)\
**Post date:** [August 13, 2015, 10:18pm UTC](https://forum.manager.io/t/how-to-divide-and-multiple-in-html-template/3541/6 "2015-08-13T22:18:53Z")

</div>

It looks like `round` filter wasn’t supported after all. I’ve just added it to the latest version (15.4.51)

---

<div class="post-metadata">

**Author:** ![Kal](https://avatars.discourse-cdn.com/v4/letter/k/9de053/32.png) [@Kal](https://forum.manager.io/u/Kal)\
**Post date:** [August 14, 2015, 2:22am UTC](https://forum.manager.io/t/how-to-divide-and-multiple-in-html-template/3541/7 "2015-08-14T02:22:24Z")

</div>

@lubos, while we’re on the subject of Liquid support, some time ago in the ‘[Introducing HTML/CSS templates](http://forum.manager.io/t/introducing-html-css-templates/1221/70)’ thread, you referred me to date formatting in Liquid, but it didn’t seem to work, and I’m wondering if this too is something that isn’t yet supported in Manager? Here’s what I wrote in that thread:

> [@Introducing HTML/CSS templates](https://forum.manager.io/t/introducing-html-css-templates/1221/70):
>
> Thank you. I’ve tried using the date filter as described on that page, but I can’t get it to work. I’ve tried:
> 
> {{ issue\_date | date: “%-d %B %Y” }}
> 
> I’m expecting this to give me ‘1 January 2015’, but instead I’m getting ‘-1 B Y’

---

<div class="post-metadata">

**Author:** ![jankiah](https://avatars.discourse-cdn.com/v4/letter/j/45deac/32.png) [@jankiah](https://forum.manager.io/u/jankiah)\
**Post date:** [August 14, 2015, 5:30am UTC](https://forum.manager.io/t/how-to-divide-and-multiple-in-html-template/3541/8 "2015-08-14T05:30:35Z")

</div>

Thanks, it works great 😄

---

<div class="post-metadata">

**Author:** ![Ealfardan](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.manager.io/ealfardan/32/63166_2.png) [@Ealfardan](https://forum.manager.io/u/Ealfardan)\
**Post date:** [January 18, 2023, 3:36pm UTC](https://forum.manager.io/t/how-to-divide-and-multiple-in-html-template/3541/9 "2023-01-18T15:36:47Z")

</div>


