cancel
Showing results for
Did you mean:

## Calculate/Display Tax on Cart Page, Cart Variables

Excursionist
46 0 4

Hi,

Maybe it’s obvious and we are just missing the correct variables, but how can we display proper EU-pricing on the CART page?

We need something like this:

Total = {{ total_price | money }}
Total excl. VAT = {{ total_price | minus:tax_price | money }}
Tax/VAT = {{ tax_price | money }}

It works perfectly for our invoice templates.

We have stumbled upon the cart.total_price variable, but this alone doesn’t solve the issue, but maybe we just need a fresh perspective ; )

This seems to be an option:

Total = {{ cart.total_price | money }}
Total excl. VAT = {{ cart.total_price | divided_by:1.xx | money }}

But how can we display the VAT-amount itself?

Thank you + Best,

S

Excursionist
46 0 4

Okay, just solved it : )

We simply had to assign variables like this:

{% assign var_net = cart.total_price | divided_by:1.xx %}
{% assign var_tax = cart.total_price | minus: var_net %}

Subtotal = {{ cart.total_price | money }}
Total Excl. VAT = {{ var_net | money }}
VAT xx% = {{ var_tax | money }}
Total = {{ cart.total_price | money }}

Best,

S

Pathfinder
92 5 9

jQuery.getJSON('/cart.js', function(cart) {
var cart_total= cart.total_price;
var shipping = parseFloat((e[0].price).split("£").pop())*100;
var total_without_tax = cart_total+shipping;
var tax = .2*total_without_tax;
var total_with_tax = total_without_tax + tax;
\$("#total_price").removeClass("hide");
if(shipping == 0){
\$("#carriage_total").text("Free");
\$("#tax_total").text(_formatRate(tax));
\$("#sum #total").text(_formatRate(total_with_tax));
}
else{
\$("#carriage_total").text(e[0].price);
\$("#tax_total").text(_formatRate(tax));
\$("#sum #total").text(_formatRate(total_with_tax));
}
});

//// html cart page
<div id="total_price" class="hide">
<p id="carriage">
<span id="carriage_title">Carriage</span><span id="carriage_total"></span>
</p>
<p id="tax">
<span id="tax_title">VAT</span><span id="tax_total"></span>
</p>
<p id="sum">
<span id="sum_title">Total</span><span id="total"></span>
</p>
</div>

Latest Topics

Latest Posts