is_shop()WC 1.0

Checks if the current page is the main shop page. Conditional tag.

The function checks two conditions. Is the current page:

  • An archive of post type product.
  • The Shop page. Specified in the settings: WooCommerce -> Settings -> Products -> Shop page.

No Hooks.

Returns

true|false.

Usage

is_shop();

Examples

0

#1 Check if the current page is the home page of the store

if ( is_shop() ) {
	echo 'This is the home page of the store!';
}
else {
	echo 'This is some other page.';
}

is_shop() code WC 10.5.0

function is_shop() {
	return ( is_post_type_archive( 'product' ) || is_page( wc_get_page_id( 'shop' ) ) );
}