• Resolved hol2006

    (@hol2006)


    My greetings!
    Guys, i’am trying to override product short descriptions in my shop, for example:
    If product exist in 1 category short description will be : brand name + product title + my template description. But i’m stuck with 1 problem, i can’t get name of the brand category where my product exist. Here is the code example. Please, help me.

    add_filter( 'woocommerce_short_description', 'single_product_short_description', 10, 1 );
    function single_product_short_description( $post_excerpt ){
        global $product;
        if ( is_single( $product->id ) )
    		if ( has_term( array( '100', '854' ), 'product_cat' ) ) {
    		{
    			if (get_locale()=='it_IT')
    			{
    				
    				$post_excerpt = ????;
    				$post_excerpt .= get_the_title(); 
    				$post_excerpt .=  __( " blalbalbal", "woocommerce" );		
    				return $post_excerpt;
    			}
    		}
    	}
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter hol2006

    (@hol2006)

    Solved the problem, if it help someone:

    $brands = wp_get_post_terms( get_the_ID(), 'pwb-brand' );
    		foreach( $brands as $brand ) {
    					$post_excerpt = $brand->name . ' ';
    			}
    Plugin Contributor titodevera

    (@titodevera)

    Thanks hol2006! ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to get brand name?’ is closed to new replies.