Version 1
// ========================================================================= // ADD TEXT TO SPECIFIC PRODUCT CATEGORY // ========================================================================= function function_name( $attr ) { global $product; if ( has_term( 'category_name', 'product_cat', $product->get_id() ) ) { echo 'TESZT'; } return $attr; } add_filter( 'woocommerce_share', 'function_name' );
Version 2
// ========================================================================= // ADD TEXT TO SPECIFIC PRODUCT CATEGORY // ========================================================================= function add_text_to_spec_cat() { global $post; $terms = wp_get_post_terms( $post->ID, 'product_cat' ); foreach ( $terms as $term ) $categories[] = $term->slug; if ( in_array( 'szivar', $categories ) ) { echo 'TESZT'; } } add_filter( 'woocommerce_after_single_product', 'add_text_to_spec_cat' );