A question about displaying sale badges in query loop

Hi bricks users.

What is the best and most optimal way to display sale badges in the query loop?

What I do now :

I put a widget like a heading in the loop and put the {woo_product_on_sale} shortcode in it. Then I customized it. But there is a problem here. When I give this widget padding to adjust the size of the sale badges, a small empty space is displayed for other products that are not on special sale.

So to solve this problem, I had to remove the sale badges from the products that are not on special sale using conditions. But it seems that this is very unprincipled. what do you think?

Go to CSS on your text element where you insert the shortcode and paste this code and adjust the padding to your liking.

root .onsale {
	padding: 1em;
}
2 Likes

I am using Conditions to hide it.

Screen Shot 2023-06-29 at 16.13.12

1 Like

thank you @Sandro,

!= what does it mean?

Hey @jolia,

!= means not equal to (in contrast to == which is equal to). So since the value field is empty the whole conditions means:

Show this element if the content in {woo_product_on_sale} is not empty.

Best,

André

2 Likes

Thanks for the great details @aslotta. Can I ask a question about woocommerce notice if possible?

Hey @jolia,

I don’t know you in person but I’d guess that you can. :wink: In the end this is a forum. So feel free to ask anything. We will see if I – or anybody else – can answer it. :slight_smile:

Best,

André

thank you @aslotta,

In the loop (to create a quick view), we first place the template widget in the loop and select the popup in it. Then quick view works easily.
But how can we display the woocommerce notice as a popup? I already asked the team and they said it is possible, but how.

Thanks in advance