Replies: 0
Hi, I’m making a menu on the product edition page where different text fields appear with: Creating custom tab
add_filter( 'woocommerce_product_data_tabs', 'add_product_menu_size' );
function add_product_menu_size( $product_data_tabs ) {
$product_data_tabs['tables-menu'] = array(
'label' => __( 'tables menu', 'test'),
'target' => 'tables_menu'',
);
return $product_data_tabs;
}
Creating text field and saving post_meta
add_action( 'woocommerce_product_data_panels', 'add_custom_product_fields_tables_menu' );
add_action( 'woocommerce_process_product_meta', 'custom_product_fields_tables_menu_save' );
function add_custom_product_fields_tables_menu() {
global $woocommerce, $post;
?>
<div id="tables_menu" class="panel woocommerce_options_panel">
<?php
woocommerce_wp_text_input(
array(
'id' => 'tables_menu',
'label' => __( 'Titel or instructions', 'woocommerce' ),
'placeholder' => 'prueba123',
'desc_tip' => 'true'
)
);
?>
</div>
<?php
}
function custom_product_fields_tables_menu_save($post_id){
$woocommerce_custom_product_text_field = $_POST['tables_menu'];
if (!empty($woocommerce_custom_product_text_field))update_post_meta($post_id, 'tables_menu', esc_attr($woocommerce_custom_product_text_field));
}
the thing is that when I go to the customs fields part, the field and the value put in it appear as aria that does not appear image: Link Image