Home › Forums › General Issues › Getting custom field from woocommerce category in home page › Reply To: Getting custom field from woocommerce category in home page
I solve a similar problem, only with tags.
I searched for a solution for almost 2 hours (I didn’t find it), I didn’t find any examples, but I managed to solve my problem myself!
If it helps:
is_main_tag – field name
product_tag_ – suffix (described at the bottom of the page https://www.advancedcustomfields.com/resources/get_field/).
$post_id = false; // current post
$post_id = 1; // post ID = 1
$post_id = “user_2”; // user ID = 2
$post_id = “category_3”; // category term ID = 3
By analogy, he suggested and tried his type (woocommerce) of taxonomy and helped!
$ value = get_field (“is_main_tag”, ‘product_tag _’. $ id);
In your case, it will most likely help:
$ value = get_field (“name_of_your_field”, ‘product_cat_’. $ id);
I hope this helps you!
Good luck colleague!
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
© 2023 Advanced Custom Fields.