
My apologies – I didn’t include all of the code, just the portion that I thought was relevant.
Yes, I had created a custom tab in my child’s function.php file:
/**
* Add a custom product data tab
*/
add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab' );
function woo_new_product_tab( $tabs ) {
// Adds the new tab
$tabs['test_tab'] = array(
'title' => __( 'specifications_custom_tab', 'woocommerce' ),
'priority' => 50,
'callback' => 'specifications_custom_tab'
);
return $tabs;
}
function specifications_custom_tab() {
// The new tab content
echo '<h2>New Product Tab</h2>';
echo '<p>Here\'s your new product tab.</p>';
}
Then I added this code straight after:
add_action('specifications_custom_tab', 'display_product_fields' );
function display_product_fields() {
$fields = get_field_objects();
if( $fields ): ?>
<ul>
<?php foreach( $fields as $field ): ?>
<li><?php echo $field['label']; ?>: <?php echo $field['value']; ?></li>
<?php endforeach; ?>
</ul>
<?php endif;
}?>
The code to add custom product fields to my custom tab (or any tab for that matter) didn’t work. Am I doing something wrong?
Thank you again for all your help!