How to display specific announcement bars on one page only?

i have 2 announcements bars i made that i only want on 1 specific page but it is showing on all my pages. can anyone help with this?

1 Like

Hi @ScentedCozy
Could you drop your store URL and the page URL that you want announcement bar appear?

store: https://scentedcozyco.com/

page i want it on : https://scentedcozyco.com/collections/deodorizing-powder

the 2 pink ones are what i want only on the attached page. all other announcement bars are fine as is.

Go to Online store > Themes > Edit code, open theme.liquid file, add this code after tag

{% if collection.handle != 'deodorizing-powder' %}
#shopify-section-sections--21674540335406__cfbc8c96-fb81-492e-b46c-18a8d8c0c42f,
#shopify-section-sections--21674540335406__8241898b-16d2-4d5b-8944-176a207060a9 {
display: none !important;
}
{% endif %}

here? right after head and before <Meta?

Yes, it correct

that did not work and it also added this to the top of my home page.

My mistake, please update code to this

{% if collection.handle != 'deodorizing-powder' %}

{% endif %}
1 Like

just to be clear, do i hit enter to start a new line or add it directly after

Both will work

thank you! worked great!

1 Like

You are most welcome.

1 Like

Hi @Dan-From-Ryviu ,

I’ve been playing around with this. But I wonder if it’s possible to use this type of coding to restrict one announcement to one collection while also not allowing the general announcements to show on that one collection?

For example, I have a retail shop with one wholesale collection. I want only the wholesale announcement to show on that collection, but not anywhere else.

Thanks in advance for any help:)

Leila

https://leilacools.com/

{% if collection.handle != ‘wholesale-items’ %}

{% endif %}