Astra_Woocommerce::astra_woo_is_subcategory( integer $category_id = null )

Check if the current page is a Product Subcategory page or not.


Description


Parameters

$category_id

(integer) (Optional) Current page Category ID.

Default value: null


Return

(boolean)


Source

File: inc/compatibility/woocommerce/class-astra-woocommerce.php

		public function astra_woo_is_subcategory( $category_id = null ) {
			if ( is_tax( 'product_cat' ) ) {
				if ( empty( $category_id ) ) {
					$category_id = get_queried_object_id();
				}
				$category = get_term( get_queried_object_id(), 'product_cat' );
				if ( empty( $category->parent ) ) {
					return false;
				}
				return true;
			}
			return false;
		}


User Contributed Notes

You must log in before being able to contribute a note or feedback.