Support

Account

Home Forums Add-ons Repeater Field Nested repeater fields and conditional statements Reply To: Nested repeater fields and conditional statements

  • Hi @eolis

    I think you can loop through the product_urls repeater and then check the keys like this:

    $productURLsRow = get_field('product_urls');
    print_r($productURLsRow);
    
    foreach($productURLsRow as $productURLs){
        foreach($productURLs as $key => $productURL){
            if(!empty($productURL)){
                if($key == 'product_urls_us'){
                    echo "us";
                } elseif ($key == 'product_urls_ca'){
                    echo "ca";
                }
            }
        }
    }

    I hope this helps.