Add a Sticky Add to Cart button in Shopify 2.0 theme

Add a Sticky Add to Cart button in Shopify 2.0 theme

Introduction

A sticky Add to Cart button is one of the simplest Shopify CRO upgrades for improving product-page usability and reducing drop-off, especially on long mobile-first product pages. In Shopify 2.0, merchants can add a sticky Add to Cart bar through custom theme code or a dedicated app, making it easier for shoppers to purchase without scrolling back to the main product form. For brands focused on higher conversion rates, better mobile UX, and stronger Shopify store performance, this small feature can support a smoother buying journey alongside broader Shopify SEO, CRO, and app optimization work.


Why You Need a Sticky Add to Cart Bar

A sticky Add to Cart bar is necessary because it keeps the purchase button visible as customers scroll through long product pages, thereby improving the user experience and potentially increasing conversions and sales. It provides a persistent call-to-action that is particularly helpful on mobile devices, prevents users from having to scroll back up, and can also display important information, such as product details and promotions.


Methods for Adding a Sticky Add to Cart in Shopify

There are several ways to add a Sticky Add to Cart button in Shopify. Some popular methods are as follows:

  1. Add a Sticky Add to Cart Button Using Custom Coding
  2. Install a Shopify App

If you are working on broader product-page improvements, our Shopify ecommerce CRO agency services focus on reducing friction and improving conversion rates across key buying steps.

Method 1: Add a Sticky Add to Cart Button Using Custom Coding

If you are a developer and comfortable with coding, then you can add the Sticky Add to Cart to your theme using custom coding. This involves adding the necessary HTML, CSS, and JS. Here is the final result. Check the GIF below to see how it will look before we go through the steps.

Add a Sticky Add to Cart button in Shopify 2.0 theme

Step 1: Navigate to Online Store > Themes > Edit Code.

Add a Sticky Add to Cart button in Shopify 2.0 theme

Step 2: Navigate to the Snippets folder and add a new snippet. Name it something like sticky-add-to-cart.liquid.

Add a Sticky Add to Cart button in Shopify 2.0 theme

Step 3: Add the following code to your file.

    
        <div id="sticky-add-to-cart" class="sticky-atc">
            <div class="sticky-atc__inner">
                <div class="sticky-atc__product">
                    {% if product %}
                        <img 
                            src="{{ product.featured_image | img_url: '100x' }}" 
                            alt="{{ product.title }}"
                            class="sticky-atc__img"
                        >
                        <span class="sticky-atc__title">{{ product.title }}</span>
                    {% endif %}
                </div>

                <button 
                    class="sticky-atc__button" 
                    id="stickyAddToCartButton"
                    type="button"
                >
                    {{ 'products.product.add_to_cart' | t }}
                </button>
            </div>
        </div>
        <style>
            #sticky-add-to-cart {
                position: fixed;
                bottom: -100px;
                left: 0;
                width: 100%;
                background: white;
                box-shadow: 0 -4px 12px rgba(0,0,0,0.1);
                z-index: 9999;
                transition: bottom .3s ease;
                padding: 12px 16px;
            }
            #sticky-add-to-cart.active {
                bottom: 0;
            }
            .sticky-atc__inner {
                display: flex;
                align-items: center;
                justify-content: space-between;
            }
            .sticky-atc__img {
                width: 50px;
                height: 50px;
                object-fit: cover;
                border-radius: 6px;
            }
            .sticky-atc__title {
                margin-left: 10px;
                font-size: 14px;
                font-weight: 500;
            }
            .sticky-atc__button {
                background: #000;
                color: #fff;
                padding: 10px 18px;
                border-radius: 6px;
                cursor: pointer;
                border: none;
                font-size: 15px;
                font-weight: 600;
            }
        </style>
        <script>
            document.addEventListener("DOMContentLoaded", function () {
                const atcBar = document.getElementById("sticky-add-to-cart");
                const addToCartForm = document.querySelector("product-form form");

                if (!addToCartForm) return;

                const addToCartBtn = document.querySelector(".product-form__submit");

                window.addEventListener("scroll", function () {
                    if (window.scrollY > 400) {
                    atcBar.classList.add("active");
                    } else {
                    atcBar.classList.remove("active");
                    }
                });

                addToCartBtn.addEventListener("click", function () {
                    addToCartForm.querySelector("[type='submit']").click();
                });
            });
        </script>
    

Step 4: Replace this Add to Cart Form selector with the actual form.

    
        const addToCartForm = document.querySelector("product-form form");
    

Step 5: Replace this button selector ID with the ID of the Add to Cart button your theme is using.

    
        const addToCartBtn = document.querySelector(".product-form__submit");
    

Step 6: Save the changes.

Step 7: Open the main-product.liquid file. 

Add a Sticky Add to Cart button in Shopify 2.0 theme

Step 8: Add the following code at the end of the section's HTML container or to a preferred location.

    
        {% render 'sticky-add-to-cart', product: product %}
    

Step 9: Save the changes.


Method 2: Install a Shopify App

If you are not comfortable with coding to add the Sticky Add to Cart button, then visit the Shopify App Store, search for the appropriate app, install it in your store, and customize the look and appearance. Here is the final result. Check the GIF below to see how it will look before we go through the steps.

Add a Sticky Add to Cart button in Shopify 2.0 theme

Step 1: Navigate to Shopify Admin > Apps.

Add a Sticky Add to Cart button in Shopify 2.0 theme

Step 2: Click the App and Sales Channel Settings button.

Add a Sticky Add to Cart button in Shopify 2.0 theme

Step 3: Visit the Shopify App Store.

Add a Sticky Add to Cart button in Shopify 2.0 theme

Step 4: Search for the app, such as Sticky Add To Cart Bar Pro

Add a Sticky Add to Cart button in Shopify 2.0 theme

Step 5: Install the app.

Add a Sticky Add to Cart button in Shopify 2.0 theme

Step 6: Reconfirm the installation process.

Add a Sticky Add to Cart button in Shopify 2.0 theme

Step 7: Select a plan that meets your needs.

Add a Sticky Add to Cart button in Shopify 2.0 theme

Step 8: Open the dashboard and click the Enable button.

Add a Sticky Add to Cart button in Shopify 2.0 theme

Step 9: Ensure this is checked and save the changes.

Add a Sticky Add to Cart button in Shopify 2.0 theme

Step 10: Navigate to the Settings and ensure these settings are enabled for desktop and mobile to meet your requirements. Also, there are other settings available to change the colors to match the brand.

Add a Sticky Add to Cart button in Shopify 2.0 theme

Step 11: Scroll down to the bottom and click the Save Settings button.

Add a Sticky Add to Cart button in Shopify 2.0 theme

Step 12: Visit your Product page to see if the integration is successful.

Some popular ones are as follows:

If you are also exploring personalization features on product pages, you may like our guide on how to add a text box to a Shopify product page.

Conclusion 

Adding a sticky Add to Cart button in Shopify 2.0 is a practical way to improve product-page usability and keep your main CTA visible when shoppers are ready to buy. Whether you choose custom code or a Shopify app, the goal is the same: remove friction, improve mobile browsing, and help more visitors convert without extra effort. If you want to go beyond one feature and improve your store’s full conversion journey, Ecomx Agency also works with Shopify brands on CRO, Shopify SEO, app integrations, and AI search optimization to turn more traffic into sales.

Ready to improve your Shopify product page conversions beyond just a sticky Add to Cart button? Talk to the experts at Ecomx Agency for CRO, Shopify SEO, and advanced product page optimization.

 

Frequently Asked Questions

Most Shopify themes do not include the exact sticky Add to Cart experience by default, so merchants usually add it through custom code or a Shopify app depending on the theme and desired design.

Yes, a sticky Add to Cart bar can improve conversions by keeping the purchase button visible while shoppers scroll through product images, descriptions, reviews, and FAQs, especially on mobile devices where space is limited.

Yes, Shopify 2.0 themes can support a sticky Add to Cart bar through custom Liquid, CSS, and JavaScript. This option gives more control over styling and functionality but usually requires theme editing.

Custom code is better if you want full control and a lightweight setup tailored to your theme. A Shopify app is better if you want a faster no-code setup, built-in settings, and easier customization from the dashboard.

Yes, a sticky Add to Cart bar can be designed to work on both mobile and desktop. Many merchants prioritize mobile first because long scrolling product pages create more friction there.

Comments(0)
You don't have any comments yet

Leave a comment
Are You Looking for a Shopify Expert?

We design, develop, optimize, and scale high-converting Shopify stores.

Get in touch
Let's Connect
Shopify Plus eCommerce Development Agency ecomx agency

Looking for a Trusted Ecommerce & Shopify Plus Agency?

We design, develop, optimize, and scale high converting Shopify Ecommerce stores that drive sales.

Get in Touch
Ecomx shopify plus agency about us page Yasin

Looking for a Shopify expert to handle a small task? Shopify Migration Experts Agency Ecomx shopify plus agency

Let’s talk about your project

Shopify Custom Theme Development Services Live Chat