Hi, I'm using Venture Theme and I would like to display compare_at_price in the cart. I edit the code in cart.liquid and it works but when I want to update the cart using quantity selector it disappears.
So I need to use AJAX to have the compare_at_price. I went to https://help.shopify.com/en/api/reference/shipping-and-fulfillment/fulfillment to see the "line_items" properties but I can't find how to get product compare_at_price, I can only get price property.
Any way to do this?
I figured out a roundabout way of doing it.
So you can't get the compare at price with the cart ajax, but it DOES give you a url to your product. Which you can then do another ajax call and get that product, then use it's compare at price. I put some "del" tags with unique id's next to my product prices, so that I know which one to inject the html into.
So kind of like this:
And this is only assuming you have one variant. Definitely not perfect, but it's just what I came up with, maybe you can build off it.
You could create an alternate cart template that outputs a json string with whatever properties you need. This would let you return cart info and the compare at price.
If you're stuck on building something just reply and we can help nudge you in the right direction.
@Jason , if you have time would you mind giving a simple example of this? I don't quite understand how by creating an alternate template you can output a JSON string.
I know how to create alternate templates, but once the template is created how would you go about creating the JSON string you need?
I'll make a quick example that you can use as inspiration for whatever you're building. Will post back with a link.
@Jason I know alternate templates but how can I create a JSON to have the compare_at_price?