Using Liquid variable inside a JavaScript snippet

Brkn
New Member
5 0 0

Hi All,

Here I have a snippet of JavaScript on the checkout of my Shopify store.

I would like to use the liquid variable: 

line_item.final_line_price

instead of line_price

for (var i = 0; i < Shopify.checkout.line_items.length; i++) {
if (Shopify.checkout.line_items[i].compare_at_price != null) {
amountSale += parseFloat(Shopify.checkout.line_items[i].line_price);
} else {
amountFull += parseFloat(Shopify.checkout.line_items[i].line_price);
}
}

How would I go about achieving this? Why is line_price working but line_item.final_line_price isn't?

Any assistance is much appreciated!

0 Likes