Change badge color and text color in Featured collection

Hello,

There are several products in featured collection, some of them are in stock, others are out of stock.

Well, out of stock has a color of the badge and a text color, the other ones that are in stock, have the same badge color but text is black.

I would like products that are in stock to be with badge green and white text, for exemple.

thanks

1 Like

Hello @kriskrs ,

Please share the store URL.

Thanks

1 Like

Hello @kriskrs

Please share your store URL and password.
So that I will check and let you know the exact solution here.

1 Like

Hey @kriskrs

You need to add some new class or use your exiting classes and add the following CSS.

{% if product.available %}
  STOC
{% else %}
  STOC EPUIZAT
{% endif %}

The following class are just a reference, pleae change with your class names.

.badge.in-stock {
  background-color: green;
  color: white;
}

.badge.out-of-stock {
  /* Keep the styles you already have for out-of-stock badges */
}

Remember, always make a backup of your theme before making any changes. If you’re not comfortable editing the theme code, consider hiring a Shopify expert or developer to assist you.

1 Like

Hello,

Looks not easy, I will try this solution, first of all. Just let me know in which files/files, should I add the codes.

Tx.

1 Like

Hello @kriskrs

Please share your store URL and password.
So that I will check and let you know the exact solution here.

Hello,

Please try:

pass: leviathan123

www.406338.myshopify.com

1 Like

Hey @kriskrs
Kindly share your Store URL and Password if enabled

Hello there,

  1. In your Shopify Admin go to online store > themes > actions > edit code
  2. Find Asset > base.css line no :- 3505 to 3507

Remove this css line no :- 3505 to 3507

.badge--bottom-left {
background: #e80a17 !important;
}
  1. In your Shopify Admin go to online store > themes > actions > edit code
  2. Find Asset > base.css and paste this at the bottom of the file:
.badge {
background-color:green;
color:white!important;
}