Support

Account

Home Forums General Issues How to display the custom field content in single product page? Reply To: How to display the custom field content in single product page?

  • Hi, I have solved this problem adding this code in functions.php:

    add_action( 'woocommerce_single_product_summary', 'woocommerce_template_top_category_desc', 1 );
    	function woocommerce_template_top_category_desc (){
     $terms = get_the_terms( $post->ID, 'wc-attibute-class' );
    if ( !empty($terms)) {
    		$term = array_pop($terms);
    				$text= get_field('txt-field', $term);
    				if (!empty($text)) {
    				echo $text;
    				}
    }
    		}