BLACK FRIDAY SALE: Get 50% Off On Any UNLIMITED DOWNLOADS Plan! Use Code "blackfriday" At Checkout

DOWNLOAD ALL NOW!

Search for a plugin or theme

How to Add ‘Continue Shopping’ Button to WooCommerce Cart Page

You are currently viewing How to Add ‘Continue Shopping’ Button to WooCommerce Cart Page

The WooCommerce cart page will only display a return to shop button when the cart is empty.

When products are in the cart, the button will disappear, and you won’t see it.

In this article, you’ll learn how to add a continue shopping button to the WooCommerce cart page.

Why Add the Continue Shopping Button

A continue shopping button will help you to increase your store revenue.

It’s a good practice to add a call to action button to the cart and encourage your customers to add more products.

In most cases, the cart and checkout pages will act like landing pages without a header or footer.

If a customer would like to navigate back to the store, he’ll initially need to enter the home URL in the address bar and navigate to the store from there.

This extra step will slow down the checkout process and eventually affect your business’ revenue.

We need to add it because the WooCommerce cart page does not have a ‘continue shopping’ button.

Default WooCommerce cart page

The following section will show you how to add the continue shopping / return to shop button using a PHP function.

Adding the Continue Shopping Button

Adding the return to shop button is easy to accomplish by entering a PHP function into our child theme.

WooCommerce extensions

If you don’t already have one, read our article on how to create a child theme.

Step #1: Open the functions.php file

The functions.php file can be found inside your theme’s folder.

First, navigate to Appearance -> Theme Editor and click on the functions.php file from the list on the right.

Edit theme functions php file

Once opened, scroll to the bottom of the file.

Step #2: Paste the function

Now, copy the function below and paste it at the bottom of the PHP file.

// Add continue shopping button to WooCommerce cart
add_action('woocommerce_cart_actions', function() {
  ?>
  <a class="button wc-backward" href="<?php echo esc_url( apply_filters( 'woocommerce_return_to_shop_redirect', wc_get_page_permalink( 'shop' ) ) ); ?>"> <?php _e( 'Return to shop', 'woocommerce' ) ?> </a>
  <?php
});
Add continue shopping button function

Once pasted, save the changes and move on to the next step.

Step #3: Test the button

After you have saved the changes, let’s run a test and verify that we’ve successfully added the button.

First, add any product to the cart and then click on view cart.

Add products to cart

If the code is working correctly, you should see the return to shop button on the left just below the products list.

Return to shop button was added to cart

Click on the button and verify that you’ve been redirected to the shop page.

Conclusion

In this article, you learned to add a continue shopping button to the WooCommerce cart page.

Leave us a comment and let us know if you have any questions about the process.

Also, make sure to subscribe to our YouTube channel and like our page on Facebook.

Share on facebook
Share on twitter
Share on linkedin
Share on pinterest
Share on email

PluginsForWP

PluginsForWP is a website specializing in redistributing WordPress plugins and themes with a variety of knowledge about WordPress, internet marketing, and blogging.

Leave a Reply