To make sure we’re in compliance with various regional laws regarding slashed out pricing, we want to hide “compare at” pricing from all of our clearance items, since they will remain at their reduced prices until they sell out (which, depending on how many we have in stock, can take months, or potentially even years).
I’ve found other posts that have a solution to hide all “compare at” pricing from the theme, but we’d still like it to show up on non-clearance items when we do our temporary sale events. Is there a way we can hide the “compare at” price for all items with a specific metafield or tag, on both product and collection pages?
We are not looking for app suggestions at this time.
The easy solution is to simply delete the compare-at price on the items you don’t want it to show. It will then just be a regular price. Other products that still have the compare-at price will still show the strike-through.
A more-effort solution is to use custom coding to literally hide or show based on certain criteria, such as metafield, tag, or collection. This could be in liquid, wrap the code in either an IF or UNLESS.
In that case you need to hide the compare at price based on the product tag. Like
{% if product.tag contain 'remove_compare_at_price' %}
style for removing the compare at price here.
{% endif %}
This way you need to add the tag where you want to remove the compare at price.
Thanks! I’m mostly looking for help with coding, since I’m not really versed in that.
Deleting the compare at prices is tricky because it opens us up for human error, which I try to avoid as much as possible.
Thank you! I’ll give this a try!
Sure, you can do this coding in your theme. This will fix the issue that you facing.
1 Like