Support

Account

Home Forums ACF PRO get value under woocommerce query Reply To: get value under woocommerce query

  • You still need to specify the IF for the term for acf to get the values.

    
    <?php
      $args = array(
        'number'     => $number,
        'orderby'    => 'title',
        'order'      => 'ASC',
        'hide_empty' => $hide_empty,
        'include'    => $ids
      );
      $product_categories = get_terms( 'product_cat', $args );
      $count = count($product_categories);
      if ( $count > 0 ){
        foreach ( $product_categories as $product_category ) {
          echo '<h4><a href="' . get_term_link( $product_category ) . '">' . $product_category->name . '</a></h4>';
          if (get_field('hexagon_text') ){
            ?>
              <p><?php the_field('hexagon_text', 
                  // specify correct post_id value for ACF
                    'product_cat_'.$product_category->term_id); ?></p>
            <?php
          }
          if (get_field('hexagon_thumbnail') ){
            ?>
              <img src="<?php the_field('hexagon_thumbnail', 
                  // specify correct post_id value for ACF
                    'product_cat_'.$product_category->term_id); ?>" />
            <?php
          }
        }
      }
    ?>