How to use product full price (Compare-at price field or value from a medafield) in checkout?

Topic summary

Goal: apply a bundle discount based on each product’s full price (stored in a metafield/compare-at price) so checkout shows the pre-discount total as the full price and the discount accordingly. Example: compare-at £800, current price £749.95, 2 items, 10% off full price → discount £160; expected pre-discount £1600 and total £1440, but checkout shows pre-discount £1499.90 (price-based), creating a mismatch.

Key constraints: compare-at price is display-only and not used in discount calculations at checkout. Shopify discounts apply to the actual “price” field, not compare-at (nor directly to metafields).

Suggestions:

  • Do not base discounts on compare-at price. Instead, adjust the discount formula to account for the gap between price and compare-at so the final total matches the intended outcome.
  • Consider using an Order Discount via Shopify Functions (Order Discount Function API). Hypothesis: an order-level discount keeps line item prices unchanged while applying the discount at the order level; this approach is not fully tested.

Status: no confirmed method to make checkout’s “before discount” use compare-at/metafield. Screenshots illustrate the discrepancy. Discussion remains open.

Summarized with AI on December 18. AI used: gpt-5.

Hi,

I’m working on custom bundles functionality, where the bundle discount should be based on the product’s full price. To achieve this, I’m storing the full price in a metafield and calculating the discount correctly in my Shopify Function. The issue I’m encountering is that while the discount is applied based on the full price, the checkout calculations are still using the product’s price (not the compare-at price or metafield) to display the “before discount” value.

For example (see the screenshots below)

  • Compare-at price: £800
  • Price: £749.95
  • Bundle discount: 10% off the full price (800 * 2 * 0.1 = £160)

While the discount amount is correct, the “before discount” price in the checkout shows £1499.90 (based on the product price) instead of £1600 (based on the compare-at price). What I need is for the before discount price in checkout to show £1600 and the order total to show £1440.

Is it possible to use the compare-at price (or product metafield) for checkout calculations to ensure the “before discount” price is correct? If so, could you please provide guidance on how to achieve this?

Thank you!

Hi MariaS,

The compare-at price is not a real discount. It is there for display purposes only. Discounts always apply to the “price,” never the “compare-at price.”

I recommend not using the compare-at-price for discounts at all. If you have to, adjust your discount calculation to account for the difference between the price and the compare-at price.

Best,

Tobe

Hi @MariaS ,

Have you tried this with Order Discount Function API?

I haven’t fully tested this but my best guess is the product discount is natively re-calculating the line item price at checkout. By applying an Order Discount the line price should remain the same price as the product page.