The codes below suits on product subcategory looping.
Get the custom field of every subcategory ( inside the loop ).
$sub_title = get_field('sub_title', 'product_cat_'.$category->term_id); if( $sub_title != '' ){ echo $sub_title; }
Get the check-box label text.
$s_field = get_field_object('field_name', $product->id ); $s_value = get_field('field_name', $product->id ); $s_label = $s_field['choices'][ $s_value ]; if( $s_label ){ $html .= '<li>field_name : '.$s_label.'</li>'; }else{ $html .= '<li>field_name : None</li>'; }
Leave a Reply