Re: how do I move a banner on the Shopping Cart page?

how do I move a banner on the Shopping Cart page?

shelleyd
Pathfinder
105 1 21

The banner is currently displaying above the 'Your Cart' title, and I want it to sit beneath it. The code to customise the banner placement is:

 

<div class='buckscc-cart-banner'></div>

 

 

Replies 8 (8)

Hamza_Hussain
Shopify Partner
62 6 13

Can you share a preview Link?

Honey G Hamza
shelleyd
Pathfinder
105 1 21

Its live now, but Id like to move it.

 

Your Shopping Cart – Onyx and Elm

Hamza_Hussain
Shopify Partner
62 6 13

There are many ways to do it and most them require custom coding and editing theme files, I'll share a code that would do the job for you if you want do it your self. 

Goto Online Store -> edit code -> search cart.liquid file or main-cart.liquid -> then paste this code below and test it.

 

<script>
document.addEventListener('DOMContentLoaded', function () {
  const cartHeader = document.querySelector('div.cart-header');
  const cartBanner = document.querySelector('div.buckscc-cart-banner');

  if (cartHeader && cartBanner && cartBanner.parentNode) {
    cartBanner.parentNode.insertBefore(cartHeader, cartBanner);
  }
});
</script>
Honey G Hamza
shelleyd
Pathfinder
105 1 21

Thanks for that, but the code doesn't seem to be working. The banner is still sitting in its original position when I preview it.

Hamza_Hussain
Shopify Partner
62 6 13

It might be because the code is placed in the wrong file. I think cart file must have another other than the ones I gave you. try add this code in theme.liquid file and reload the cart page

Honey G Hamza
shelleyd
Pathfinder
105 1 21

No luck with that one either, unfortunately.

Hamza_Hussain
Shopify Partner
62 6 13

Should it look something like this ?


Hamza_Hussain_0-1744724811002.png

 

 

Honey G Hamza
shelleyd
Pathfinder
105 1 21

Yes, that's exactly how I would like it to look.