Home Forums Front-end Issues Display product fields


Display product fields

  • 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 ): ?>
    			<?php foreach( $fields as $field ): ?>
    				<li><?php echo $field['label']; ?>: <?php echo $field['value']; ?></li>
    			<?php endforeach; ?>
    	<?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.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.