Customize the text from a costum tab on the product page
-
Hi
The problem I have is that I customized the tabs of the product page and worked with WPML to make it translatable. But the text is the same for all the product and I need a different text for each product.
Here is the code I added or modified on functions.php:
add_filter( ‘woocommerce_product_tabs’, ‘woo_custom_description_tab’, 98 );
function woo_custom_description_tab( $tabs ) {$tabs[‘reviews’][‘callback’] = ‘woo_custom_description_tab_content’; // Custom description callback
return $tabs;
}function woo_custom_description_tab_content() {
echo ” . __( ‘Próximamente’, ‘woocommerce’ ) . ”;
echo ‘ ‘;
}add_filter( ‘woocommerce_product_tabs’, ‘woo_rename_tabs’, 98 );
function woo_rename_tabs( $tabs ) {$tabs[‘reviews’][‘title’] = __( ‘Preguntas frecuentes’, ‘woocommerce’ ); // Rename the reviews tab
return $tabs;
}
add_filter( ‘woocommerce_product_tabs’, ‘woo_new_product_tab’ );
function woo_new_product_tab( $tabs ) {// Adds the new tab
$tabs[‘test_tab’] = array(
‘title’ => __( ‘Especificaciones’, ‘woocommerce’ ),
‘priority’ => 30,
‘callback’ => ‘woo_new_product_tab_content’
);return $tabs;
}
function woo_new_product_tab_content() {
echo ”;
echo ” . __( ‘Dimensiones: 20 x 10 x 5’, ‘woocommerce’ ) .
” . __( ‘Peso: 3kg’, ‘woocommerce’ ) .
” . __( ‘Ingredientes: Agua, sirope de agave*, biofermentos de microorganismos funcionales (Bio-fMF?): > 108 ufc/ml (más de 100 millones de microorganismos probióticos) (Bifidobacterium bifidum, Lactobacillus acidophilus, Lactobacillus bulgaricus, Lactobacillus fermentum, Lactobacillus plantarum, Lactobacillus rhamnosus, Lactobacillus casei y Streptococcus thermophilus) y fresa*.’, ‘woocommerce’ ) . ” . __( ‘*Obtenido de agricultura ecológica.’, ‘woocommerce’ ) . ”;
}
- The topic ‘Customize the text from a costum tab on the product page’ is closed to new replies.