is_woocommerce
Filters whether the current request is being handled by a WooCommerce template.
Usage
add_filter( 'is_woocommerce', 'wp_kama_is_woocommerce_filter' );
/**
* Function for `is_woocommerce` filter-hook.
*
* @param bool $is_woocommerce True on the shop archive, a product taxonomy archive or a single
* product.
*
* @return bool
*/
function wp_kama_is_woocommerce_filter( $is_woocommerce ){
// filter...
return $is_woocommerce;
}
- $is_woocommerce(true|false)
- True on the shop archive, a product taxonomy archive or a single product.
Changelog
| Since 2.1.0 | Introduced. |
Where the hook is called
is_woocommerce
woocommerce/includes/wc-conditional-functions.php 36
return apply_filters( 'is_woocommerce', is_shop() || is_product_taxonomy() || is_product() );