Home Forums Backend Issues (wp-admin) Many to many relationship with extra fields.


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?

  • Checkbox with a list of available grapes

  • 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.

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.