03:47:41

How to Make Compare at Pricing Show at Checkout

With this small tweak Shopify’s compare-at pricing now displays in checkout and reporting, resolving longstanding challenges for merchants. Originally designed to show MSRP, compare-at pricing has evolved into a discounting tool, but inconsistencies in checkout display, reporting accuracy, and discount interactions caused issues.

DAte

Feb 18, 2025

Category

Shopify

Reading Time

5

We cracked the code! Compare-at pricing now displays in checkout and reporting on Shopify. This long-requested improvement helps merchants create a more transparent discounting experience while ensuring backend reporting accurately reflects sales performance.


Why Compare-At Pricing Matters in Shopify

Shopify originally introduced compare-at pricing as a way to show a product’s Manufacturer’s Suggested Retail Price (MSRP). Over time, many merchants began using it to highlight discounts, but this shift came with limitations:

Checkout display issues: Compare-at pricing wasn’t always visible throughout the purchasing journey.

Reporting discrepancies: Sales reports didn’t properly account for discounts applied via compare-at pricing.

Discounting conflicts: Compare-at pricing wasn’t always compatible with other discount mechanisms.

So, we set out to refine the experience, making compare-at pricing work the way merchants expect today.


The Key Enhancements


1. More Accurate Reporting

Discounts applied through compare-at pricing now reflect correctly in backend reporting. Merchants get a clearer, more reliable view of sales performance without manual adjustments.


2. Seamless Checkout Experience

Shoppers can now see exactly how much they are saving—from product pages to checkout. This creates a consistent, transparent customer experience that boosts conversion rates and builds trust.


3. Greater Control Over Discounts

Merchants can now fine-tune how compare-at pricing interacts with other discounts, preventing unexpected stacking or conflicts. This ensures more predictable pricing strategies.


How It Works

At its core, the solution is a combination of a cart transform and a discount function:

  • Pin the price to the compare-at price.

  • Apply the discount back to the intended sale price.

This approach ensures compare-at pricing is accurately reflected across sales channels like Google, from the product page through checkout and into backend reporting. It is a simple yet powerful way to ensure pricing transparency while maintaining merchant control over discounting.


The Three Core Parts:

  1. Metafield for Sale Price
    A metafield stores the desired sale price of a given variant. We use a simple Gadget app to automate this. A Shopify Flow might also be suitable, but since function activations need to trigger on install, we opted for an app.


  2. Cart Transform: UpdateOperationFixedPricePerUnitAdjustment
    This operation raises the price of a variant back up to the compare-at price specified on the variant.


  3. Discount Function: DiscountApplicationStrategy.ALL
    The function applies a per-unit discount equal to the difference between the sale price and the compare-at price of a variant. It is surfaced as a combinable discount, allowing merchants to control how it stacks with other discounts using combine rules.



What This Means for Shopify Merchants

With these enhancements, compare-at pricing is no longer just a display feature—it is an integral part of the discounting and reporting ecosystem in Shopify. Whether you are running promotions, syncing pricing across multiple sales channels, or just looking for more accurate analytics, this update makes a big difference.


Implementing Better Compare at Pricing on Shopify Plus


The following post covers off how to add better compare at to merchants on Shopify Plus.

At it's core, there are three core parts that make up better compare at pricing, these are:


Metafield for Sale Price
We store the desired sale price for each product variant in a dedicated metafield. This metafield is updated automatically via a simple Gadget app. Although Shopify Flow is an option, our need for function activations on install led us to use an app for greater control and consistency.


Cart Transform: UpdateOperationFixedPricePerUnitAdjustment
When a customer adds an item to the cart, we use a cart transform operation to update the variant’s price back to its compare-at value. This operation ensures that the full price is visible on the cart, setting the stage for a subsequent discount that effectively reflects the sale price.


Discount Function: DiscountApplicationStrategy.ALL
Finally, we apply a discount function that calculates a per-unit discount equal to the difference between the compare-at price and the sale price stored in the metafield. This discount is implemented as a combinable discount (using the ALL strategy), which means merchants can control how it stacks with other promotions or discounts based on their combine rules.

How the Code Ties It All Together


Below is a walkthrough of the main components in our implementation:


Cart Transformation

Before applying the discount, we update the cart’s line items cost. The cart transform operation uses UpdateOperationFixedPricePerUnitAdjustment to adjust the price back up to the compare-at price. For each cart line that meets our criteria we verify if the compare-at price is higher than the sale price. If it is, we adjust the cart line’s price. 


Applying the Discount

Next, we calculate the discount to be applied. By comparing the original price to the sale price (retrieved from our metafield), we compute the difference and derive a percentage discount:


Shopify Markets & UpdateOperationFixedPricePerUnitAdjustment


Since an UpdateOperationFixedPricePerUnitAdjustment works relative to the buyer’s currency (not the store’s currency), here are a few strategies to consider:

  • Maintain a Price Sheet:
    Keep a price sheet that holds the relevant compare at prices for different currencies.

  • Early Exit on Currency Mismatch:
    Simply return early in both functions if presentmentCurrencyRate != 1.

  • Adjust Using presentmentCurrencyRate:
    You could use presentmentCurrencyRate to calculate the correct value. Fair warning, this might lead to mismatches between the value your function returns and what’s actually shown on the storefront.

  • Signed Line Item Attributes:
    Pass the compare_at price as a signed line item attribute (using something like Liquid’s hmac_sha256). Then, in a Rust function (since JS isn’t ideal for crypto work), verify that the value is within an acceptable variance when compared to a value derived from presentmentCurrencyRate. If the product still has an active compare at price, proceed with the transform and discount.
    Side note: If you haven’t played around with signed line item attributes yet, now’s a great time to experiment—it’s a cool introduction to using Rust functions and opens up some neat possibilities on the storefront.


Why Do We Need a Metafield?


When you apply an UpdateOperationFixedPricePerUnitAdjustment, it pins both the price and the compare at price to the values specified in the update operation. This means you lose access to the original price (which is needed if you ever need to re-calculate or “discount back” to it). Storing the original price in a Metafield ensures you can always reference it later for any future operations


Other gotchas

Interaction with Other Functions & Standard Discounts:


When deploying on a storefront, be mindful of how this function interacts with other functions and standard discounts. Remember, apps might use functions for non-obvious purposes. For instance, if you’re also using UpdateOperationFixedPricePerUnitAdjustment for product add ons (like warranties), make sure to thoroughly test against those cases.


Thorough Testing is Essential:


Test, test, test! The behavior of these functions can have a direct monetary impact. This isn’t something to roll out just before a big sale—the deployment needs to be carefully planned and closely monitored in a live environment.

Author

Kynon Hickman

Related News

Related News

Our Services

Our Services

select Work

select Work

select Work

Showcasing our standout projects that blend creativity, strategy, and cutting-edge engineering.

Newsletter

Get the latest news into your inbox

Stay informed and up-to-date with the latest news delivered straight to your inbox for a seamless and convenient experience.

Newsletter

Get the latest news into your inbox

Stay informed and up-to-date with the latest news delivered straight to your inbox for a seamless and convenient experience.

Newsletter

Get the latest news into your inbox

Stay informed and up-to-date with the latest news delivered straight to your inbox for a seamless and convenient experience.