Cart

WooCommerce Show Custom Text On Empty Cart Page

WooCommerce cart page showing custom text because the cart is empty

Pre-Requisites

There are no pre-requisites in order for you to be able to implement this solution.

How To Implement This Solution?

Simply copy the pre-coded solution to your active theme’s functions.php or preferably the Code Snippets Plugin.

About This Solution

If the user navigates to the cart page when there is nothing in their cart, they will see a cart notification, “Your cart is currently empty.” To change that particular cart notification, check out our guide on how to change this here. This guide however shows you how to add new text to the cart page when it’s empty.

/**
 * Snippet Name:	WooCommerce Show Custom Text On Empty Cart Page
 * Snippet Author:	ecommercehints.com
 */

add_action( 'woocommerce_cart_is_empty', 'ecommercehints_empty_cart_text' );

function ecommercehints_empty_cart_text() {
   echo 'You are seeing this text because the cart is empty 😐';
}

Snippet Benefits

  • Improve the user experience by letting them know information on the cart page when it’s empty.

100 WooCommerce Conversion Rate Optimisation Tips

This field is for validation purposes and should be left unchanged.

Let’s collaborate!

Need to outsource WordPress development?

Join forces with UnlimitedWP for an outsourced white label web development service you can truly rely on.

First Timer Here?

Sign up to receive 20% off on your first month with us.

26027
WELCOME OFFER