Website Building » WooCommerce » How Do I Add a Sticky to Cart Button in WooCommerce?

How Do I Add a Sticky to Cart Button in WooCommerce?

Last updated on October 1, 2022 @ 10:04 pm

Adding a sticky “Add to Cart” button to your WooCommerce store can help increase your conversion rate and average order value. By keeping the “Add to Cart” button visible at all times, you make it easy for customers to add products to their cart without having to scroll back up to the top of the page. In this article, we’ll show you how to add a sticky “Add to Cart” button in WooCommerce.

There are two ways to add a sticky “Add to Cart” button in WooCommerce: using a plugin or adding custom code to your theme.

Using a Plugin

The easiest way to add a sticky “Add to Cart” button in WooCommerce is by using a plugin. We recommend using the Sticky Add to Cart for WooCommerce plugin. It’s free, it’s easy to use, and it works with all themes.

Once you’ve installed and activated the plugin, go to Settings → Sticky Add to Cart. From here, you can choose where you want the sticky “Add to Cart” button to appear on your product pages.

You can also choose whether you want the button to be sticky on all pages or just on specific pages. And that’s it! The plugin will automatically add a sticky “Add To Cart” button to your WooCommerce store.

Adding Custom Code

If you don’t want to use a plugin, you can also add a sticky “Add To Cart” button by adding custom code to your theme. First, you’ll need to create a file called cart-sticky.js and upload it to your child theme’s directory. You can get the code for this file from GitHub.

PRO TIP: If you are not a developer, we recommend that you do not attempt to add a sticky to cart button in WooCommerce. This can be a complex process and can lead to unexpected results.

Next, edit your child theme’s functions.php file and add the following code:

function wc_sticky_add_to_cart() {
if ( is_product() ) { ?>

Dale Leydon

Dale Leydon

Sysadmin turned Javascript developer. Owner of 20+ apps graveyard, and a couple of successful ones.