Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sale badge does not appear if there is a variant with a 0 compare_at_price #3581

Open
dontgiveajack opened this issue Aug 7, 2024 · 2 comments

Comments

@dontgiveajack
Copy link

Describe the current behavior

When some variants of a product have a compare_at_price set that is higher than the price, a sale badge will show on the collection.

If a merchant has typed in 0 as the compare at price, this causes the sale badge to not appear even when there are variants on sale.

Describe the expected behavior

Even if 0 is typed on a compare at price, the Sale badge should still appear if there are other variants are on sale.

It seems the theme code is not properly checking other variants on sale in card-product.liquid line 135

price.liquid should also be updated to display the compare_at_price correctly

Version information (Dawn, browsers and operating systems)

  • Dawn Version: 15.02
  • Chrome Version 127.0.6533.100
  • macOS Version 14.5

Possible solution

Add additional code to check if the compare_at_price_varies and that it is not using the 0 value.

Additional context/screenshots

image

@ConduciveMammal
Copy link

@dontgiveajack The compare at price needs to be higher than the price, The compare price is the "original" non-sale price, and the price field becomes the sale price.

For example: If a product is originally £100, and it's reduced to £50, the compare at price field has £100 entered in, and the price field has £50 entered in.

View the code here as a working example: https://github.com/Shopify/dawn/blob/main/snippets/price.liquid#L49

@dontgiveajack
Copy link
Author

@ConduciveMammal , thanks for taking a look!

I totally understand the price vs compare at price. Perhaps this is more of a platform issue.

When the compare_at_price is not filled, it shows 0.00 (greyed out). So, if a 0 were typed in there, I feel like it should not return a value and be treated like it was null

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants