woocommerce_get_product_class_include_taxonomies

woocommerce_get_product_class_include_taxonomies

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter

See hook in core

Displaying hooks found in version: woocommerce.9.8.1

apply_filters('woocommerce_get_product_class_include_taxonomies') is found 1 times:

  • /includes/wc-template-functions.php line 727
    723
    724
    725
    726
    727
    728
    729
    730
    731
    732
    733
        $classes[] = 'has-default-attributes';
    }
     
    // Include attributes and any extra taxonomies only if enabled via the hook - this is a performance issue.
    if ( apply_filters( 'woocommerce_get_product_class_include_taxonomies', false ) ) {
        $taxonomies = get_taxonomies( array( 'public' => true ) );
        $type       = ProductType::VARIATION === $product->get_type() ? 'product_variation' : 'product';
        foreach ( (array) $taxonomies as $taxonomy ) {
            if ( is_object_in_taxonomy( $type, $taxonomy ) && ! in_array( $taxonomy, array( 'product_cat', 'product_tag' ), true ) ) {
                $classes = array_merge( $classes, wc_get_product_taxonomy_class( (array) get_the_terms( $product->get_id(), $taxonomy ), $taxonomy ) );
            }