• Resolved marisman

    (@marisman)


    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’ ) . ”;
    }

Viewing 4 replies - 1 through 4 (of 4 total)
  • Nico

    (@nicolamustone)

    Automattic Happiness Engineer

    Hi,
    I would use a plugin that allows you to create custom tabs. For example this one is free: https://www.skyverge.com/product/woocommerce-custom-product-tabs-lite/

    It would make it much easier for you to define a tab and also translate it with WPML.

    It also has a premium version.

    Thread Starter marisman

    (@marisman)

    It’s compatible with WPML? I will need to translate it.

    Nico

    (@nicolamustone)

    Automattic Happiness Engineer

    Its logic is very basic so yes, it should be compatible. Also, it’s a free plugin so you can just try it out if you want.

    Plugin Support Hannah S.L.

    (@fernashes)

    Automattic Happiness Engineer

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Customize the text from a costum tab on the product page’ is closed to new replies.