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.
WooCommerce Conversion Rate Optimisation (CRO) eBook
100 WooCommerce Conversion Rate Optimisation Tips

Leave a Reply

If you are going to write code in the comments, please wrap it between code tags.

Your email address will not be published. Required fields are marked *

Other Recent Guides

Subscribe To Emails

Get exclusive WooCommerce tips that I only share with email subscribers

Join hundreds of other subscribers