Hi,
Im creating a custom AJAX cart and just stuck on a a few formatting bits.
I have this part of my javascript which is getting the updated info from the cart and displaying it, my issue is with the image and the prices. In Liquid I can use this to output a resized version of the image url:
{{ item.image | img_url: ‘200x’ }}
but in my javascript I can only get the standard URL not the resized one:
${item.image}
How can I put the url from javascript through the shopify filter?
Similarly my price is just displaying as an integer whereas Id like to put it through this filter:
{{ item.price | money_with_currency }}
Heres the part of my script outputting these variables:
var itemContent = `
<div class=''>
<img src='${item.image}' alt='${item.title }' width='200px' height='auto' />
</div>
<div class='qps-cart-title'>
<h3>${item.title}</h3>
</div>
<div class='qps-cart-price'>
${item.price}
</div>
<div class='qps-cart-qty'>
${item.quantity}
</div>
<div class='qps-cart-remove'>
<a href="#" class="remove-from-cart" data-variant-id="${item.variant_id}">Remove from Cart</a>
</div>`;
Thanks