is_shop_page() ) { return $page_id; } return $this->get_shop_page_id(); } /** * Checks if the current page is the shop page. * * @return bool Whether the current page is the WooCommerce shop page. */ protected function is_shop_page() { if ( function_exists( 'is_shop' ) && function_exists( 'wc_get_page_id' ) ) { return is_shop() && ! is_search(); } return false; } /** * Returns the id of the set WooCommerce shop page. * * @return int The ID of the set page. */ protected function get_shop_page_id() { static $shop_page_id; if ( ! $shop_page_id ) { $shop_page_id = function_exists( 'wc_get_page_id' ) ? wc_get_page_id( 'shop' ) : ( -1 ); } return $shop_page_id; } }