Sale badge % OFF Value Not Changing For Different Priced Variants (Dawn Theme)

Topic summary

A user successfully implemented a custom “Sale” badge that displays percentage discounts based on compare prices using code snippets from a previous community post. However, the badge is not updating dynamically when different product variants with varying prices are selected.

Current Issue:

  • The percentage OFF value remains static regardless of which variant is chosen
  • This occurs even when variants have different price points

Context:

  • Theme: Dawn
  • Implementation involves CSS customization for product pages
  • The user has provided example links and screenshots demonstrating the problem

Status: The discussion appears to be seeking a solution to make the discount percentage recalculate dynamically based on the selected variant’s specific pricing.

Summarized with AI on November 14. AI used: claude-sonnet-4-5-20250929.

Hi guys,

I’ve used the snippets from this post to change my “Sale” badge to display the % OFF based on the compare prices.

Works great however just needs a slight adjustment to show the correct % OFF when different priced variants are selected, as can be seen here the % OFF remains the same.

Many thanks.