I am struggling to get my head round the best way to do something.
I have a repeater field for ‘products’, where it has fields like name, features, image etc which I can keep repeating depending on how many for the post.
Now within this repeater I want to have fields for certain things, size, width, color etc. The issue is that some of these fields would only be relevant to certain products. All the products within the post will require the same fields, however the product and fields depend on what the post is about.
My thinking is I need a way to select what product it is, or what fields to show somewhere when creating the new post, and then these fields are cloned into the product repeater each time depending on the product.
So on a post, I select it is a jumper from a dropdown, then it will load certain fields in the repeater, if I select it is a shed, then it will load different fields in the repeater.
I hope that makes some sort of sense, how would I do this and where would I define the different options that would load?
It sounds like this would be a case for a grouping of conditionals built within your Repeater field. This is used for: selects, checkboxes, booleans, and radio buttons.
Just like you mentioned, you’d have a radio button or dropdown that would select the category of product at the top, which would then cause certain options to be available for you.
You’d do this within your repeater & have your first option (radio/dropdown/etc.) And then list additional fields underneath almost as if you would want them ALL appearing. The only difference is that you then set rules for them under the ‘conditional’. “Show if _____”, etc. Otherwise, it won’t show as an option to pick anything from.
Hope that helps! Let me know if I can clarify anything.
Viewing 2 posts - 1 through 2 (of 2 total)
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