is_woocommerce()
Is_woocommerce - Returns true if on a page which uses WooCommerce templates (cart and checkout are standard pages with shortcodes and thus are not included).
Hooks from the function
Return
true|false
.
Usage
is_woocommerce();
Examples
#1 Display the custom block if it's a WooCommerce page
<?php if ( is_woocommerce() ) { ?> <div class="block-woocommerce"> Some block content. </div> <?php }
is_woocommerce() is woocommerce code WC 7.5.1
function is_woocommerce() { return apply_filters( 'is_woocommerce', is_shop() || is_product_taxonomy() || is_product() ); }