Automattic\WooCommerce\Internal\LegacyAssets
LegacySelect2UsageTracker::get_current_frontend_page_type
Get the current frontend page type.
Method of the class: LegacySelect2UsageTracker{}
No Hooks.
Returns
string.
Usage
// private - for code of main (parent) class only $result = $this->get_current_frontend_page_type(): string;
LegacySelect2UsageTracker::get_current_frontend_page_type() LegacySelect2UsageTracker::get current frontend page type code WC 11.1.2
private function get_current_frontend_page_type(): string {
if ( is_cart() ) {
return 'cart';
}
if ( is_checkout() ) {
return 'checkout';
}
if ( is_account_page() ) {
return 'my_account';
}
if ( is_shop() ) {
return 'shop';
}
if ( is_product() ) {
return 'product';
}
if ( is_product_category() ) {
return 'product_category';
}
if ( is_product_tag() ) {
return 'product_tag';
}
if ( is_product_taxonomy() ) {
return 'product_taxonomy';
}
if ( is_front_page() ) {
return 'front_page';
}
if ( is_home() ) {
return 'home';
}
if ( is_search() ) {
return 'search';
}
if ( is_archive() ) {
return 'archive';
}
if ( is_singular() ) {
return 'singular';
}
return 'other';
}