You can display an ACF Custom field repeater with ACF Pro inside a WooCommerce product page by creating the Custom Field and the Sub Fields and then add the code below to functions.php.
This specific code, creates repeater fields of a Name that has a link to download brochures from a several URLs.
The main Field name is “download_brochure_with_url” and the Sub Fields are:
- Text field, where we add the name of link “brochure_name”
- URL field, where we add the URL link “download_brochure_url”
// Display ACF Custom Field Reapeater
add_action( 'woocommerce_single_product_summary', 'awk_acf_repeater', 10);
function awk_acf_repeater () { ?>
<?php if(get_field('download_brochure_with_url')): ?>
<ul class="awkClass">
<?php while(has_sub_field('download_brochure_with_url')) { ?>
<li><a href="<?php the_sub_field('download_brochure_url'); ?>" target="_blank"><?php the_sub_field('brochure_name'); ?> </a> </li>
<?php } ?>
</ul>
<?php endif; ?>
<?php }