Cracking the Code: How to Keep 'Compare At' Prices Visible in Your Shopify Cart & Checkout
Hey everyone, it's great to be back with some insights straight from the Shopify Community! We've all been there – trying to make our amazing deals and discounts shine, especially with those impactful 'compare at' prices. Recently, a store owner named Hafsah134 brought up a super common, yet incredibly frustrating, issue that many of you might relate to: getting those crucial compare-at prices to display consistently in the cart and even the checkout.
The Disappearing Act: What Hafsah134 Experienced
Hafsah134's situation perfectly illustrates a challenge that can really dampen a customer's enthusiasm. They noticed that when an item with a special deal was added to their cart, the 'compare at' price (that's the original, higher price that gets crossed out) would show up briefly, creating that wonderful sense of a bargain. But then, as they progressed, it would mysteriously vanish, leaving only the current, discounted price. You can imagine how that feels – it's like the deal suddenly isn't as good as it initially seemed! This is a real conversion killer, isn't it? We want our customers to see that value all the way through their buying journey.
Here are the images Hafsah134 shared, showing exactly what was happening and what they wanted to achieve:
Why This Happens (and Why Experts Ask for Your Store URL)
This isn't just a random glitch; it often comes down to how different sections of your Shopify theme are coded to display pricing. The cart page, which is part of your theme, has its own Liquid files, and sometimes the logic to show the compare_at_price isn't explicitly carried through to all states or views. This is especially true if you're using an older theme or one that hasn't been fully optimized for showing both prices dynamically.
The actual checkout page, on the other hand, is generally much more locked down by Shopify for security and consistency. This means direct code edits to alter the core pricing display there are usually off-limits. This distinction is key!
This is precisely why community experts like Devcoder and Mustafa_Ali immediately asked Hafsah134 for their store URL and password. To provide an exact solution, they needed to dive into the specific theme code to see where the compare_at_price object might be getting overlooked or incorrectly rendered in that particular theme's cart template.
The Solution: Ensuring 'Compare At' Prices Shine on Your Cart Page
While we can't directly modify the Shopify checkout page's core pricing display for custom elements like this, we absolutely can (and should!) ensure the compare-at price is prominently displayed on your cart page. This is usually where the 'disappearing act' happens before the customer even gets to the secure checkout. The fix typically involves a small but powerful tweak to your theme's Liquid files.
Step-by-Step Guide to Editing Your Cart Template:
- Step 1: Back Up Your Theme! Seriously, don't skip this. Before making any code changes, always create a safety net. Go to your Shopify admin, navigate to Online Store > Themes, find your current theme, click Actions > Duplicate. This creates a safe copy you can revert to if anything goes awry.
- Step 2: Access Your Theme Code. Still in Online Store > Themes, click Actions > Edit code for your active theme.
- Step 3: Locate the Cart Template File. In the 'Sections' or 'Snippets' directory (the exact location varies by theme, especially between older themes and newer OS 2.0 themes like Dawn), you'll be looking for files that control your cart page's display. Common names include
cart-template.liquid,main-cart-items.liquid, or sometimes justcart.liquid. You might need to do a quick search within the code editor (Ctrl+F or Cmd+F) for phrases like 'cart item price' or 'item.price' to pinpoint the right section. - Step 4: Find and Modify the Price Display. Once you've found the relevant section (it often loops through
cart.itemsto display each item in the cart), look for where the item's price is displayed. It will likely look something like{{ item.price | money }}or{{ item.final_price | money }}. You want to add logic to display thecompare_at_priceif it exists and is higher than the current price. - Step 5: Implement the Code Snippet. Here's a common way to implement this. You'll want to place this before or around the existing price display line, or modify that line directly. Remember to adjust class names to match your theme's styling for the best look!
{% if item.original_price != item.final_price %}
Original price
{{ item.original_price | money }}
Sale price
{{ item.final_price | money }}
{% else %}
{{ item.final_price | money }}
{% endif %}
A quick note on the code: I've used item.original_price and item.final_price here, which are standard Liquid objects for cart items. item.original_price refers to the compare-at price, and item.final_price is the actual price after any discounts. This snippet checks if there's a difference between the two and displays both if applicable, striking through the original price. You might need to adjust the class names (e.g., product-card__price, product-card__price--compare, product-card__price--sale) to match your theme's existing CSS for proper styling and ensure it looks seamless.
- Step 6: Save and Test. Click 'Save' and immediately go to your live store. Add an item with a compare-at price to your cart and check if both prices are now displaying correctly. Test different products, and ensure the styling looks good. If you're seeing unexpected results, that's why we made that backup!
Beyond the Cart: Understanding the Checkout Page Limitations
Now, about the actual Shopify checkout page – that's a different beast entirely. Shopify keeps the checkout process highly standardized for security and PCI compliance. This means you generally can't inject custom Liquid code there to alter how prices are displayed in the same way you can on your cart page. Any changes to the checkout layout or appearance usually happen through the Theme Editor (Online Store > Themes > Customize > Theme settings > Checkout) where you can change colors, fonts, and add a logo, but not much else in terms of granular price structure.
So, for Hafsah134's desire to see both prices at 'checkout,' if they meant the actual Shopify checkout flow, that's much tougher, if not impossible, without a Shopify Plus plan and specific checkout extensibility features. However, by ensuring the compare-at price is clear and persistent on the cart page, you've done 90% of the work in communicating that deal to your customer before they hit the final payment step. The cart page is your last real chance to reinforce that value with custom code.
This little community discussion highlights a crucial point: every detail matters in e-commerce. Clearly displaying discounts and compare-at prices isn't just about aesthetics; it's about transparency and maximizing your conversion rates. It builds trust and reinforces the value proposition for your customers. So, take a moment to check your cart page, make those tweaks, and let your amazing deals shine through! If you get stuck, remember the community is always there to help – just like Devcoder and Mustafa_Ali were ready to dive in, asking for those crucial details to provide tailored assistance. Happy selling!


