Support

Account

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.