Hi,
I’m trying to load ACF fields on custom product tabs, but without great success. The code I’m using, to create the tabs:
function custom_product_tabs( $tabs) {
$tabs['section_nutritional'] = array(
'label' => __( 'Nutritional Declaration', 'woocommerce' ),
'target' => 'section_nutritional',
'class' => array( 'show_if_simple', 'show_if_variable' ),
);
$tabs['section_directions'] = array(
'label' => __( 'Directions', 'woocommerce' ),
'target' => 'section_directions',
'class' => array( 'show_if_simple', 'show_if_variable' ),
);
return $tabs;
}
add_filter( 'woocommerce_product_data_tabs', 'custom_product_tabs' );
I’m trying to load the ACF field like this:
function woocommerce_product_section_nutritional()
{
global $woocommerce, $post;
echo '<div id="section_nutritional" class="panel woocommerce_options_panel hidden">';
echo $variable = get_field('teste_texto_nutri');
woocommerce_wp_text_input(
array(
'id' => 'nutritional_table',
'placeholder' => 'Insert Table',
'label' => __('Test ACF', 'woocommerce'),
'desc_tip' => 'true',
'value' => the_field('teste_texto_nutri')
)
);
woocommerce_wp_textarea_input(
array(
'id' => 'nutritional_text',
'placeholder' => 'Insert Text',
'label' => __('Additional Text', 'woocommerce'),
'desc_tip' => 'true'
)
);
}
I’ve also tried to create a callback function in the definition of the new tabs, but without success.
What I’m trying to do is possible? If yes, can anyone help me on how to do it?