V
V
Vasilek_132020-09-08 22:08:39
WordPress
Vasilek_13, 2020-09-08 22:08:39

How to display custom ACF fields set for an attribute on a product page (woocomerce)?

Hey!
Created "trademark" attributes and added "trademark names" there.
ACFom added a text field for the "trademark" taxonomy, which is also available when editing "trademark names".
For example, in the trademark he created "Nike" and filled in a custom field for him, indicated a link to the official site.
Now you need to display the value of this custom field for all products that have the Nike attribute (link to the official website). Tell me which cycle to create, otherwise I’ve been muddling all day and everything is past ...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Zagainov, 2020-09-09
@pasha_zigzag

In a cycle.
$term = $product->get_attribute( 'pa_brand' );
$term = get_term_by('slug', $term, 'pa_brand');
the_field('url', 'pa_brand_'.$term->term_id);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question