Home › Forums › Front-end Issues › Issue with Conditional Logic in Nested ACF Repeater Fields Not Updating Correct › Reply To: Issue with Conditional Logic in Nested ACF Repeater Fields Not Updating Correct
You have to base you logic on the selection in your field that sets the condition and not the fields that are conditional.
ACF does not update fields hidden by conditional logic so the old value will still exist.
$condition = get_sub_field('select_field_name');
if ($condion == 'option 1') {
$value = 'get_field('conditional_field_1');
} elseif ($condion == 'option 2') {
$value = 'get_field('conditional_field_2');
}
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.