is_cart()WC 1.0

Is_cart - Returns true when viewing the cart page.

No Hooks.

Return

true|false.

Usage

is_cart();

Examples

0

#1 Let's check if this is a shopping cart page.

if ( is_cart() ) {
	//basket page
}

is_cart() code WC 8.7.0

function is_cart() {
	$page_id = wc_get_page_id( 'cart' );

	return ( $page_id && is_page( $page_id ) ) || Constants::is_defined( 'WOOCOMMERCE_CART' ) || wc_post_content_has_shortcode( 'woocommerce_cart' );
}