is_cart()
Checks if the current page is the cart page. Conditional tag.
Hooks from the function
Returns
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 9.9.5
function is_cart() { /** * Filter to allow for custom logic to determine if the cart page is being viewed. * * @since 2.4.0 * @param bool $is_cart Whether the cart page is being viewed. */ return apply_filters( 'woocommerce_is_cart', false ) || Constants::is_defined( 'WOOCOMMERCE_CART' ) || CartCheckoutUtils::is_cart_page(); }