Custom Engagement Solutions
Unlock tailored solutions with a free, no-obligation strategy session.

Expert Developers & Engineers on Demand

Scale Your Team with Skilled IT Professionals

Expert Guidance for Digital Transformation
Shopify SEO
Unlock tailored solutions with a free, no-obligation strategy session.
Expert Developers & Engineers on Demand
Scale Your Team with Skilled IT Professionals
Expert Guidance for Digital Transformation
We bring Shopify expertise to every industry—custom solutions, faster results!
Unlock tailored solutions with a free, no-obligation strategy session.
Expert Developers & Engineers on Demand
Scale Your Team with Skilled IT Professionals
Expert Guidance for Digital Transformation
Boost sales, drive traffic, and build loyalty with high-converting apps and top-rated support.
See What We Built and How it Worked!
Shopify insights that keep you ahead.
Where Global Talent Meets Shopify Brilliance
7th Floor, PV Enclave, Opp. Courtyard by Marriott, Off Sindhu Bhavan Road, Bodakdev, Ahmedabad, Gujarat 380054
3120, Kirwin avenue Mississauga L5A3R2
2/23 Foster Street, Surry Hills, NSW 2010 Australia.
We’re Here to Help You Achieve Your Goals
7th Floor, PV Enclave, Opp. Courtyard by Marriott, Off Sindhu Bhavan Road, Bodakdev, Ahmedabad, Gujarat 380054
3120, Kirwin avenue, Mississauga L5A3R2
2/23 Foster Street, Surry Hills, NSW 2010 Australia.
Sticky Add To Cart button for Shopify is used to add a sticky bar that has add to cart button with required product information. This custom add to cart button shopify code helps to increase the conversion rate of the product page.
When the product information is long, users often find it hard to find an add to cart button because it is at the beginning or bottom of the page. So here we have shared Sticky Add to Cart Button Shopify Code will solve the issue by adding a sticky cart at the top or bottom of the page.
Most of the users are visiting the website on mobile devices. This Add to Cart Button Shopify Code helps visitors to add a product to the cart.
Default step: Go to shopify admin/then select your theme / then edit code
Step: 1 Go to first templates/ product.liquid
Step:2 then go to product-template section
Step: 3 then go to product-template snippet file and add this code
Step: 4 then after go to your theme.js file
Add this following code in this theme.js file
$('.add-sticky-click.second_btn').on('click',function(e){
$('body').addClass('btn_second_show_loader');
var addcontbtn = $(this);
$(this).addClass('btn--loading');
setTimeout(function(){$(addcontbtn).removeClass('btn--loading'); }, 1000);
$('.product-single__form .add-to-cart.mobile_hide').trigger('click');
})
$('.ctm_size_add').on('click',function(e){
$(this).addClass('btn_loading');
$(this).find('.text').text('Adding');
var _this = $(this);
var val = $(this).closest('li').data('val');
$('[option-name="Size"] .swatch-view .swatch-view-item[orig-value="'+val+'"] .swatch-button').trigger('click');
var form = $(this).closest('#shopify-section-product-template').find('form');
$('[option-name="Size"] .swatch-view .swatch-view-item[orig-value="'+val+'"] .swatch-button').removeClass('swatch-selected');
$.ajax({
type: "post",
url: "/cart/add.js",
data: form.serialize(),
dataType: "json",
success: function(data){
console.log(data);
_this.removeClass('btn_loading');
_this.addClass('btn_loaded');
_this.find('.text').text('Added');
$('body').addClass('ctm_btn_zindex');
$.getJSON('/cart',function(cart){
theme.cart.getCart().then(window.this.buildCart(cart));
})
setTimeout(function(e){
_this.removeClass('btn_loaded');
_this.find('.text').text('Add to Bag');
$('body').removeClass('ctm_btn_zindex');
},3000);
setTimeout(function(e){
$('.sticky_pro_img .close-sticky').trigger('click');
$('.js-drawer-open-cart').trigger('click');
},1500);
},
error: function(err){
console.log(err);
_this.removeClass('btn_loading');
_this.find('.text').text('Failed Add');
setTimeout(function(e){
_this.removeClass('btn_loaded');
_this.find('.text').text('Add to Bag');
},3000);
}
})
})
});
Step: 5 for the sticky button go to assets/custom.css
For the sticky add to cart button you can add this code
.bottom-sticky-product {
position: fixed;
bottom: 0;
width: 100%;
z-index: 99999999;
border: 1px solid #bdbdbd;
background-color: #fff;
padding: 6px;
display: flex;
justify-content: space-between;
}
These are the steps you need to follow when performing shopify buy button customization specially sticky add to cart button in Shopify. While this is an exhaustive step-by-step procedure or list, it can still help you to create sticky or custom add to cart button seamlessly.
Categorized in:
As the CTO at Shiv Technolabs & CartCoders, I am liable for instigating, planning, integrating, and implementing the organization's strategic orientation. I gather the most significant tech news in addition to sharing the information I gained while serving as the CTO of Shiv Technolabs, a renowned web and mobile app development company. I am pleased to answer questions as a most valuable expert for Shiv Technolabs Private Limited and to share my experience. I offer a keen insider's perspective on technical advancements.
View All ArticlesProjects delivered in 15+ industries.
95% retention rate, building lasting partnerships.
Serving clients across 25+ countries.
60+ pros | 10+ years of experience.