<?php
/* ## WooCommerce: Add wordpress custom field Tab on the Product Page ## */
/*--------------- Add belove code in theme's function.php file --------------*/
/* Add custom field description tab in Product page */
add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab' );
function woo_new_product_tab( $tabs ) {
$tabs['product_short_description'] = array(
'title' => __( 'Ingredients', 'woocommerce' ),
'priority' => 50,
'callback' => 'woo_new_product_tab_content'
);
return $tabs;
}
function woo_new_product_tab_content() {
echo get_post_meta(get_the_ID(), 'custom_field_name', TRUE); // Add here custom field name
}
/*. Add custom field description tab in Product page */
?>
/* ## WooCommerce: Add wordpress custom field Tab on the Product Page ## */
/*--------------- Add belove code in theme's function.php file --------------*/
/* Add custom field description tab in Product page */
add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab' );
function woo_new_product_tab( $tabs ) {
$tabs['product_short_description'] = array(
'title' => __( 'Ingredients', 'woocommerce' ),
'priority' => 50,
'callback' => 'woo_new_product_tab_content'
);
return $tabs;
}
function woo_new_product_tab_content() {
echo get_post_meta(get_the_ID(), 'custom_field_name', TRUE); // Add here custom field name
}
/*. Add custom field description tab in Product page */
?>