Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Hoping someone can assist – I am trying to use the Advanced Custom Fields plugin together with the repeater add-on, with Woocommerce products.

To begin with, I have setup two products, Product A and Product B as part of the Woocommerce plugin.

Now, with the Custom Fields (ACF) plugin, I have created two field groups, Field Group A and Field Group B – both fields being of field type "Repeater".

Now based on the above setup and hoping it makes sense, I now need to attach custom Field Group A to Product A and custom Field Group B to Product B.

I have attempted to do this within each of the field groups via the location rule, where I have specified:

Post Type is equal to product

But by doing this, it is placing both Field Group A and Field Group B to each of the Products, which is not want I want.

In addition to the above location rule, I also need another rule to target the post-title or post-name but do not seem to have this available as a drop-down within the location rules.

1) Can anyone pls assist as to how to target Field Group A to just Product A and the same for Field Group B to Product B?

2) If I am not able to target each product, can people please suggest how I can access the Field Groups A or B based on the Product I am on?

3) Is what I am trying to do above, even possible with ACFs together with Products?

Any help would be great.


share|improve this question
add comment

put on hold as off-topic by toscho 21 hours ago

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

You can make a custom taxonomy for your products. Than you make a few terms wich u call: Group a, group b, and so on. At the settings of your metabox in afc, you can choose:

'if taxonomy term' is equal to 'group a'

and on the other group (for wich you make a diffrent metabox/fieldsgroup) you do the same but than for group b

share|improve this answer
thanks for your reponse but sorry to be a pain as I am not too familiar with setting up a custom taxonomy against my products. Could you please provide a bit more of a description on how to do this or point me to a link that explains it - would really appreciate it. Thanks. –  tonsils Jan 20 at 13:16
I generated this code : themergency.com/generators/taxonomy-code-output/?id=74010 , you can paste it in you functions.php I am not sure if it is working though, because I´m not sure if the cpt key is right. If it doesn´t work you can also try to install the plugin: Custom post type UI. Taxonomy's are mostly used as a extra 'category' . But for this they can also come in handy –  Maartje Jan 20 at 13:23
FYI, I have installed the Custom Post Type UI but unsure how to proceed from here and how to break out to group a and group b within ACF. Sorry, just can't seem to suss this out. –  tonsils Jan 20 at 14:24
In custom post type ui, you can go to manage taxonomy's and add a new one. You do have to know the post type key of products from woocommerce, I don't know that. But if you don't know you can try something like 'product' or 'products' –  Maartje Jan 21 at 13:08
Hi, when you say "Add a new one" - what would be the name of this new taxonomy? From the looks of it, the post type key of products from woocommerce is 'product'. What do I do then after I have added a new taxonomy? Thanks. –  tonsils Jan 21 at 13:16
show 3 more comments

Not the answer you're looking for? Browse other questions tagged or ask your own question.