How to Highlight a Variant After It's Added to the Cart?

Hi everyone,

I’m looking for a way to highlight a product variant on the product page if it’s already added to the cart. Ideally, when a customer selects a variant that is in the cart, it should be visually indicated—either by adding a border, or differentiate with opacity.

Is there a way to achieve this using Liquid, JavaScript, or CSS? Any suggestions or code examples would be greatly appreciated!

Thanks in advance!

Hi @Sudhan ,

Could you share the store URL and the theme name?

Suggestion- Get the cart data in the product liquid and add condition behalf of the variants id. If the variant id exist in the cart data then add a class on the variant div and using css add the property on that class.

Thanks