Home › Forums › Backend Issues (wp-admin) › Many to many relationship with extra fields.
Hello everyone.
I am looking to make an online wine merchants. Every wine can have many grapes and every grape can have many wines so essentially each wine has grape tags.
I would like to include a percentage to the grape tag allowing for the correct order to be displayed when listing the grape tags and being able to natural language the grape tags as links.
e.g. Chateau Foobar has 60% Merlot and 40% Cabernet Franc
Is there a way of doing this in ACF
What type of fields are you currently using for these relationships?
What type of fields? Relationship? Post Object? Taxonomy?
What are Wines? Grapes? Posts? Terms?
Woocommerce – wines are products
grapes are currently a checkbox choice in ACF
If you mean that it is a checkbox field, then you really can’t do what you want to do as far as sorting.
You would need to use something like a repeater where each row allows selecting 1 type of grape and setting a percentage and then you’d need to build functions to sort the rows of the repeater in the correct order based on the % sub field.
I can’t find the the repeater field in my ACF is this a pro feature?
Yes, the repeater field is a Pro feature.
To do this without a repeater would be difficult.
You could do it by having a conditional field for each grape type that is shown when that type is checked to allow entering a %. Sorting the grape types by this value would be more difficult because each would be in their own field.
Without a repeater there isn’t any way outside of the code you right to associate one field with another field.
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!
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.