Jump to content

Add visible custom badge on product page

Go to solution Solved by SaranyaDesigns,

Recommended Posts

Hello there!

I want to add a badge on product pages for products with a specific tag.

I was able to add a 'coming soon' badge to all products on the main shop page, now it would be nice to also display a badge on the product page to make it clear.

The main shop page: https://www.kivi-jewelry.com/shop

One example of a page I want to display a 'coming soon' badge: https://www.kivi-jewelry.com/shop/p/liivarebane

And I would like the tag to like the 'sold out' tag on this page: https://www.kivi-jewelry.com/shop/p/test

And here is the CSS code I have put so far:

//GENERAL FOR BADGES
.products.collection-content-wrapper .product-mark {
    text-transform: none;
    font-weight: 500;
    font-size: 14px;
}

//COMING SOON
// Add a badge "coming soon" on products on main shop page 
.product-mark.sf-nouveau {
    position: absolute;
    top: 0;
    background: rgba(255, 255, 255, 0.5);
    padding-top: 0.4rem;
    padding-bottom: 0.4rem;
    padding-left: 0.7rem;
    padding-right: 0.7rem;
    margin-top: 1.5rem;
    color: #443f41;
    letter-spacing: 1.5px;
  }
// Hide Add to Cart button when product is coming soon
.tag-nouveau .ProductItem-details .sqs-add-to-cart-button {
  display: none !important;
}

// Add a badge "coming soon" on products on product page???


//SOLD OUT
// Add a badge "sold out" on products on main shop page
.view-list .product-mark.sold-out {
    position: absolute;
    top: 0;
    background: rgba(255, 255, 255, 0.5) !important;
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
    padding-left: 0.7rem;
    padding-right: 0.7rem;
    margin-top: 1.5rem;
    color: #443f41 !important;
    letter-spacing: 1.5px;
}

// Add a badge "sold out" on products on product page
.view-item .product-mark.sold-out {
    background: #fff !important;
    color: #443f41 !important;
    letter-spacing: 1.5px;
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    justify-content: center;
    align-items: center;
    text-align: center;
    display: inline-block !important;
    font-size: 18px;
}

// Hide price on main shop page page when product is sold out
.sold-out .product-price {
  display: none !important;
}

// Hide price on product page when product is sold out
.sold-out .ProductItem-details .product-price, .sold-out .ProductList-overlay .ProductList-meta .product-price {
  display: none;
}

// Hide Add to Cart button when product is sold out
.sold-out .ProductItem-details .sqs-add-to-cart-button {
  display: none;
}


Also, 2 other minor queries:

  1. how can I reduce the space under the badge here:
    image.thumb.png.def1fbff2fd0462c1a7e9e1779504a28.png
     
  2. how can I reduce the space above the lower bit of text here: 
    image.thumb.png.f1af05dff3be59a19e6b2e46c10d9296.png


Can anyone help me?
By the way this community is amazing, I have found so many answers in this forum today 😍

Thank you!

Link to comment
  • Solution

@floradouville Perhaps this could work?

.product-layout-side-by-side .tag-nouveau h1.ProductItem-details-title:after {
	content: 'Bientôt disponible';
	display: block;
	background: #fff;
	color: #443f41;
	font-size: 18px;
	letter-spacing: 1.5px;
	padding: 0.7rem 1.5rem;
	width: 200px; /* you may need to play around with this one */
}
  

It would be a pseudo-element, but should achieve the desired outcome?

Link to comment

@floradouville for your other two spacing issues, try this... 

.sold-out .ProductItem-details .product-mark.sold-out {
	margin-bottom: 0;
}
.ProductItem .ProductItem-additional {
	margin-top: 25px; /*you can play around with this number or just put 0 if you want no margin at all... */
}

You may need to include !important in order to override the existing styles...

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.