I assume this is possible, but probably with more digging into things than I’ve been able to do…
WooCommerce has a bunch of taxonomies associated with it. One is Attributes, commonly used for things like “Shirt Color”, and then under that attribute would be terms, like “Red”, “Yellow” and “Blue”. Here’s how these are represented in the backend UI:
Something seems a bit odd with the attributes, they have an edit URL like this that does not reference a post_id or anything, and the numbering starts at 1 and increments with each attribute:
The terms are simple, which is why I guess it’s easy to add fields there with the normal taxonomy selections in ACF:
wp-admin/edit-tags.php?taxonomy=pa_altacom-ceramics&post_type=product (list of terms)
wp-admin/term.php?taxonomy=pa_altacom-ceramics&tag_ID=2804&post_type=product&wp_http_referer=%2Fwp-admin%2Fedit-tags.php%3Ftaxonomy%3Dpa_altacom-ceramics%26post_type%3Dproduct (editing an individual term)
And you can see here we use ACF to add a field for an image to each term:
Hope that all makes sense – we want to add a field not at the “term” level (we’ve already done that), but at the attribute level, which seems to be hard because Woo is doing something unique here…
Technically we could add the field to the terms, but that would mean setting a few fields on a few thousand terms, which would be kind of laborious.
Did you ever solve this? I was looking for something similar and hope to have found a solution in:
Adding Custom Post Type UI. Then add a new custom posttype like “Attribute extras”. After that you can add a new group in ACF and add an image and extra description for example. Also you add a Taxonomy field with the field name matching the slug of the Attribute. You do this for each Attribute (in my case about 30).
Finally when you add a new “Attribute Extra” you use the Title to match the slug of the actual attribute. In front you then make some custom code to display the image instead of the attribute value.
Still testing this as I want to import all (2000+) Attribute Extra’s. I’ll let you know if it works
The page in question is a custom admin sub page that mimics a taxonomy admin page. I haven’t got a clue how this is added or if there is any way to change it. I did a search on the subject and found no information on changing this page. Changing this page would require WC having some type of action hook that runs when showing this page that would allow you to add ACF field groups to the form. It appears that the only source of information on if this can be done would be WC. If you can get information on if/how it is possible to alter this page then I could probably help you to add ACF fields to the page.
Then the next problem would be where the information is actually stored and how to retrieve it because this page is simply an interface that allows you to add product attributes. From my understanding of this, each “attribute” that is added is a actually a new custom taxonomy and then then list for each of these has sub terms. So the interface is actually letting you create your own custom taxonomies associated with WC. So there really isn’t anywhere that this information is stored or to store any information associated with it. This would be like having information stored that is used on all “categories” or “tags” there is nowhere in WP to store information like this. So even if you could figure out how to alter this page I think that the effort would be wasted.
You must be logged in to reply to this topic.
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!
© 2022 Advanced Custom Fields.