All things Shopify and commerce
I want to show Announcement bar only on Cart page not on every page how can i do this? I'm using dawn theme currently.
Solved! Go to the solution
This is an accepted solution.
Hi, @amisha-29
Steps:
1. Go to your Shopify Admin:
Online Store > Themes > Dawn > Edit code
2. Locate the announcement bar section:
Find and open:
sections/announcement-bar.liquid
3. Add a condition to render only on the cart page:
Wrap the entire content of the announcement bar with this {% if %} condition:
{% if request.page_type == 'cart' %}
<!-- Original announcement bar code here -->
{% endif %}
Your updated announcement-bar.liquid might look like this:
{% if request.page_type == 'cart' %}
<div class="announcement-bar">
<!-- existing announcement bar HTML here -->
</div>
{% endif %}
If you will unable to implement the same then I'm happy to do this for you, let me know.
Hope this helps! If yes then Please don't forget hit Like and Mark it as solution!
Hi @amisha-29,
1. Go to Online Store -> Theme -> Edit code.
2. Open your theme.liquid file
3. In theme.liquid, paste the below code before </head>
<script>
document.addEventListener("DOMContentLoaded", function () {
const bar = document.querySelector('.announcement-bar-section');
if (!bar) return;
if (window.location.pathname === '/cart') {
bar.classList.remove('hide-bar');
} else {
bar.classList.add('hide-bar');
}
});
</script>
<style>
.hide-bar {
display: none !important;
}
</style>
Thanks!
I added this code as you told me but now I'm not able to see anything for the header section so i can add that announcement bar only on my cart page. Header section is not showing.
This is an accepted solution.
Hi, @amisha-29
Steps:
1. Go to your Shopify Admin:
Online Store > Themes > Dawn > Edit code
2. Locate the announcement bar section:
Find and open:
sections/announcement-bar.liquid
3. Add a condition to render only on the cart page:
Wrap the entire content of the announcement bar with this {% if %} condition:
{% if request.page_type == 'cart' %}
<!-- Original announcement bar code here -->
{% endif %}
Your updated announcement-bar.liquid might look like this:
{% if request.page_type == 'cart' %}
<div class="announcement-bar">
<!-- existing announcement bar HTML here -->
</div>
{% endif %}
If you will unable to implement the same then I'm happy to do this for you, let me know.
Hope this helps! If yes then Please don't forget hit Like and Mark it as solution!
It worked thankyou
June brought summer energy to our community. Members jumped in with solutions, clicked ...
By JasonH Jun 5, 2025Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025