Shopify themes, liquid, logos, and UX
I have sticky add to cart bar and want to scroll function to it. Need help to add below js code like where to add in global.js to get exact scroll function so that sticky add to cart bar will only appear after scroll. Using shopify 2.0 dawn theme.
$(window).scroll(function (event) {
var height = $(window).height();
var scroll = $(window).scrollTop();
//console.log(scroll + " " + height);
if(scroll > height){
$(".sticky_cart").addClass("show");
} else {
$(".sticky_cart").removeClass("show");
}
});
$("#btn-sticky-cart").click(function(){
$(".paymentButtonsWrapper #AddToCart").click();
});
Solved! Go to the solution
This is an accepted solution.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
you should put this code at the very bottom of your gobal.js file. So it will be handy to find and change it later.
where you have added the code. there is not code in your theme global.js file
https://cdn.shopify.com/s/files/1/0337/3737/5879/t/37/assets/global.js
plz also add jquery to your theme
This is an accepted solution.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
that's nice!
one more thing the product image overlaps the bar plz add the following code at the bottom of "base.css"
.sticky_cart{
z-index: 99999;
}
plz replace 99999 with just 99
and also one more thing
.sticky_cart{
z-index: 99;
padding-right: 110px;
}
plz share the store URL.
We now offer a sticky cart solution with a free plan. It works with all themes, check it out: https://apps.shopify.com/pasilobus-sticky-cart
Here is the solution to add sticky add to cart bar in your store:
Discover how to increase customer engagement on your store with articles from Shopify A...
By Jacqui Apr 23, 2025Hey Community 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025