woocommerce_is_cart
Filter to allow for custom logic to determine if the cart page is being viewed.
Usage
add_filter( 'woocommerce_is_cart', 'wp_kama_woocommerce_is_cart_filter' );
/**
* Function for `woocommerce_is_cart` filter-hook.
*
* @param bool $is_cart Whether the cart page is being viewed.
*
* @return bool
*/
function wp_kama_woocommerce_is_cart_filter( $is_cart ){
// filter...
return $is_cart;
}
- $is_cart(true|false)
- Whether the cart page is being viewed.
Changelog
| Since 2.4.0 | Introduced. |
Where the hook is called
woocommerce_is_cart
woocommerce/includes/wc-conditional-functions.php 103
return apply_filters( 'woocommerce_is_cart', false ) || Constants::is_defined( 'WOOCOMMERCE_CART' ) || CartCheckoutUtils::is_cart_page();