Jump to content

How can I disable a specific section from one of my shop pages without disabling it on all shop pages?

Recommended Posts

Posted

Site URL: https://mackenziekuck.com/shoptextiles/gift-wrap

I have a tiny section just underneath my header that gives some additional instructions when shopping in my online store. However, there is one page of my shop where this banner does not apply. I'd like to be able to disable that section from just this page. If I delete it, it will be deleted from the entire shop which I don't want. What code can I insert that will do this?

  • Replies 1
  • Views 432
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Posted

You can use this code to Website Tools > Code Injection > Footer (Note: Footer, not Header)

<script>
  if (document.location.pathname=== "/shoptextiles/gift-wrap") {
    document.querySelector('body').classList.add('gift-wrap')
  }</script>
<style>
  body.gift-wrap [data-section-id="66d8e2279ea2465448b61cbf"] {
    display: none;
}
body.gift-wrap h2.nested-category-title {
    padding-top: 50px;
}
</style>

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

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.