Displaying all ACF field labels and values from a specified field-group on WooCommerce product page

I see what you’re trying to achieve. You can use ACF’s acf_get_field_group function with the title as a parameter to retrieve the field group and its ID.

Try this code:

/*==============================================================
Create More Details tab ================================================================*/ 
if (class_exists('acf') && class_exists('WooCommerce')) {
    add_filter('woocommerce_product_tabs', function($tabs1) {
        global $post, $product; 

        $tabs1['rpl-' . sanitize_title('More Details')] = [
            'title' => 'More Details',
            'callback' => 'rpl_custom_woocommerce_tabs',
            'priority' => 10
        ];

        return $tabs1;
    });
}

function rpl_custom_woocommerce_tabs($key) {
    global $post;

    echo '<h2>More Details</h2>';
    
    $specs_fields = get_specs_fields();

    foreach ( $specs_fields as $name => $field ):
        echo '<strong>' . $field['label'] . ':</strong> ' . $field['value'] . '<br>';
    endforeach;
}

function get_specs_fields() {
    global $post;

    $specs_group_title="Your Field Group Name Here"; // Change this to your ACF field group name
    
    // Fetching the group by title
    $group = acf_get_field_group($specs_group_title);
    if (!$group) return array();

    $specs_fields = array();

    $fields = acf_get_fields($group['key']);

    foreach ( $fields as $field ) {
        $field_value = get_field($field['key'], $post->ID);

        if (!empty($field_value)) {
            $field['value'] = $field_value;
            $specs_fields[$field['name']] = $field;
        }
    }

    return $specs_fields;
}

Make sure to change ‘Your Field Group Name Here‘ to the name of your ACF field group. Then give that a try and see if it meets your requirements.

techhipbettruvabetnorabahisbahis forumuedusedusedueduseduedueduseduseduedus