Bricks Condition: Check Repeater

Check if ACF repeater has rows and content. Used for bricks display conditions.

Information

{acf_product_information}

function repeater_has_content($repeater_field, $subfield) {
    // Check if the repeater field has any rows
    if (have_rows($repeater_field)) {
        // Loop through the rows
        while (have_rows($repeater_field)) {
            // Set the current row as active
            the_row();

            // Get the value of the sub-field
            $subfield_value = get_sub_field($subfield);

            // Check if the sub-field has content
            if (!empty($subfield_value)) {
                // If it has content, return true
                return true;
            }
        }
    }
    // If no rows found or no sub-field has content, return false
    return false;
}
Review Your Cart
0
Add Coupon Code
Subtotal