Skip to main content
added details
Source Link
markratledge
  • 8.7k
  • 6
  • 40
  • 62

Try this; it's from the WC function that displays a link to the cart when there are items in the cart. The differences are the use of global and the > 0 operand:

global $woocommerce;
if ( sizeof( $woocommerce->cart->cart_contents) > 0 ) :
    echo '<p>hello there</p>';
endif;

Try

global $woocommerce;
if ( sizeof( $woocommerce->cart->cart_contents) > 0 ) :
    echo '<p>hello there</p>';
endif;

Try this; it's from the WC function that displays a link to the cart when there are items in the cart. The differences are the use of global and the > 0 operand:

global $woocommerce;
if ( sizeof( $woocommerce->cart->cart_contents) > 0 ) :
    echo '<p>hello there</p>';
endif;
Source Link
markratledge
  • 8.7k
  • 6
  • 40
  • 62

Try

global $woocommerce;
if ( sizeof( $woocommerce->cart->cart_contents) > 0 ) :
    echo '<p>hello there</p>';
endif;