Home › Forums › General Issues › Conditional Display of ACF Single Product Page › Reply To: Conditional Display of ACF Single Product Page
The issue is being understood. You are showing fields on a WC product page. While you are using ACF to hold those fields the conditions involved and the code required is specific to Woo Commerce (WC), not ACF.
In your function, you need to get the product ID as outlined in the first link I provided: https://stackoverflow.com/questions/27385920/woocommerce-get-current-product-id
Then you need to use that product ID to get the categories that the product is in as outlined in the second link I provided: https://stackoverflow.com/questions/15303031/woocommerce-get-category-for-product-page
Then you need to loop over that list of categories to see if you product is in a given category and display the fields based on that condition.
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!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.