Support

Account

Home Forums Backend Issues (wp-admin) How to retrieve WooCommerce Product Attribute as Taxonomy Term selected

Helping

How to retrieve WooCommerce Product Attribute as Taxonomy Term selected

  • Hi,

    I have this ACF field:
    Field Name: brand
    Field Type: Taxonomy
    Taxonomy: pa_brand
    ACF Field

    WooCommerce Product Attribute:
    Name: brand
    slug: brand
    term id: 51
    WooCommerce Product Attribute

    I’m trying these codes but it doesn’t work:

    <?php the_field(‘brand’, $term); ?>
    
    <?php the_field(‘brand’, ‘product_51’); ?>

    Or how will I know the category to use if I’m wrong.

  • I think I already got it

    $brand = get_field_object("brand");
    							$term = get_term($brand["value"], "pa_brand");
    							echo $brand["value"];
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘How to retrieve WooCommerce Product Attribute as Taxonomy Term selected’ is closed to new replies.