astra_woo_shop_parent_category()

Add and/or Remove Categories from shop archive page.


Description


Source

File: inc/compatibility/woocommerce/woocommerce-common-functions.php

	function astra_woo_shop_parent_category() {
		if ( apply_filters( 'astra_woo_shop_parent_category', true ) ) : ?>
			<span class="ast-woo-product-category">
				<?php
				global $product;
				$product_categories = function_exists( 'wc_get_product_category_list' ) ? wc_get_product_category_list( get_the_ID(), ';', '', '' ) : $product->get_categories( ';', '', '' );

				$product_categories = htmlspecialchars_decode( wp_strip_all_tags( $product_categories ) );
				if ( $product_categories ) {
					list( $parent_cat ) = explode( ';', $product_categories );
					echo apply_filters( 'astra_woo_shop_product_categories', esc_html( $parent_cat ), get_the_ID() ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
				}

				?>
			</span>
			<?php
		endif;
	}

Changelog

Changelog
Version Description
1.1.0 Introduced.


User Contributed Notes

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