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 CustomizeWoo.com FREE
 * @sourcecode    https://businessbloomer.com/?p=21585
 * @author        Rodolfo Melogli
 * @compatible    WC 2.6.14, WP 4.7.2, PHP 5.5.9
 */

add_action( 'woocommerce_cart_is_empty', 'bbloomer_add_content_empty_cart' );

function bbloomer_add_content_empty_cart() {
echo 'This will show on the empty cart page';
}

Share:

Leave a Reply