is_cart()
Is_cart - Returns true when viewing the cart page.
No Hooks.
Return
true|false
.
Usage
is_cart();
Examples
#1 Let's check if this is a shopping cart page.
if ( is_cart() ) { //basket page }
is_cart() is cart code WC 7.5.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' ); }