product price after adding tax has 3 decimal digits

Jacob_Clamp
Shopify Partner
4 0 1

Hi, 

 

The product prices are listed without including the Tax (GST). For instance,  I have a product priced at $363.64 before GST.

 

If a customer buys two of these items, the subtotal will appear as:

$363.64 x 2 = $727.28

 

To include the GST, we multiply this subtotal by 1.1:

$727.28 x 1.1 = $800.008

 

Then, we round it to show 2 decimals $800.01, which is what the customer sees on the checkout page. However, even though this calculation is correct mathematically, I'd prefer to eliminate the third decimal place and round it to show $800.00.

 

I've tested with various combinations of the code below, but haven't had success:

 

{{ item.line_price | round:2 | times: 1.1 | money }}

or

{{ item.line_price | times: 1.1 | round:2 | money }}

 

Any help would be much appreciated. 

Reply 1 (1)
Jacob_Clamp
Shopify Partner
4 0 1

Hi, 

Thanks for the reply. Unfortunately, it didn't work for me. 

I removed the parameters one by one to see what is the result of each of them. 

I put the result from each part of the liquid code in front of it. 

{{ item.line_price | times: 1.1 | money | remove: "," | round | money }} -> $0.00

{{ item.line_price | times: 1.1 | money | remove: "," | round }} -> 0

{{ item.line_price | times: 1.1 | money | remove: "," }} ->$800.01

{{ item.line_price | times: 1.1 | money }} -> $800.01

{{ item.line_price | times: 1.1 }} ->80000.8

 

Thanks again,