Home » WooCommerce: Add Content to Empty Cart Page

WooCommerce: Add Content to Empty Cart Page

by Tutor Aspire

A Business Bloomer fan asked me a great question: “I’m using your visual hook guide to add content above the cart, however I notice that it doesn’t work if the cart is empty. Are there hooks specifically for empty carts?“.

Well, let’s take a look if we have anything available… (hint: of course we do!).

WooCommerce: add content to the empty cart page

PHP Snippet: Add Content to the Empty Cart Page – WooCommerce

/**
 * @snippet       Add Content to Empty Cart Page - WooCommerce
 * @how-to        Get tutoraspire.com FREE
 * @author        Tutor Aspire, BusinessBloomer.com
 * @compatible    WooCommerce 4.5
 * @donate $9     https://www.tutoraspire.com
 */
  
add_action( 'woocommerce_cart_is_empty', 'tutoraspire_add_content_empty_cart' );
 
function tutoraspire_add_content_empty_cart() {
   echo 'This will show on the empty cart page';
}

You may also like