Hi,
I use ACF in order to implement the product description on WooCommerce.
I still have problems displaying the custom field on my single product page.
The custom field name is “Compatibility”.
I added the following code in – Flatsome Child: functions.php – but it doesn’t work.
add_action('woocommerce_before_add_to_cart_form', 'display_product_fields' );
function display_product_fields() {
$fields = Compatibility ();
if( $fields ): ?>
<ul>
<?php foreach( $fields as $field ): ?>
<li><?php echo $field['label']; ?>: <?php echo $field['value']; ?></li>
<?php endforeach; ?>
</ul>
<?php endif;
}?>
What is this doing?
$fields = Compatibility ();
This is not anything that I am familiar with and would not be how to get the fields, unless this function you are calling is getting the fields.