Site logo

Archived topic

Problem file function Generatepress with Review Tabs Woocommerce

6 replies · Started by Giovanni on January 14, 2022

Viewing posts 1–7 of 7

Hi all,

I added some TABs to the product sheet and deleted "other information".

I did it all with the code in thema's function file.

I have activated the reviews from the woocommerce settings but I cannot see the TAB and there is no possibility to write some reviews.

The stars are visible under the product and nothing else.

this is the code: as you can see I have not deleted the review tab.

I don't really understand where the problem is.

Advice?

I have the updated thema along with all plugins.

/**
* Add a custom product data tab
*/
add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab' );
function woo_new_product_tab( $tabs ) {

//Attribute Tempi tab
$tabs['tempi_tab'] = array(
'title' => __( 'Tempi', 'woocommerce' ),
'priority' => 100,
'callback' => 'woo_tempi_tab_content'
);

//Attribute Pagamento tab
$tabs['pagamento_tab'] = array(
'title' => __( 'Pagamento', 'woocommerce' ),
'priority' => 120,
'callback' => 'woo_pagamento_tab_content'
);

//Attribute Garanzia tab
$tabs['garanzia_tab'] = array(
'title' => __( 'Garanzia e Reso', 'woocommerce' ),
'priority' => 140,
'callback' => 'woo_garanzia_tab_content'
);

return $tabs;

}

// New Tab contents

function woo_pagamento_tab_content() {
// The Pagamento tab content
echo '<h2>Metodi di Pagamento</h2>';
echo '<p>Puoi pagare con bonifico bancario oppure con Paypal utilizzando il tuo conto o la carta di credito-debito.</p>';
echo '<p>Pagamento a rate con Soisy: sei libero di scegliere le rate secondo i tuoi tempi. Aggiungi il prodotto al carrello e segui la procedura indicata.</p>';
}
function woo_tempi_tab_content() {
// The Tempi tab content
echo '<h2>Tempi di produzione e spedizione</h2>';
echo '<p>Consegna entro 15 giorni lavorativi. Spedizione DHL 24h con assicurazione totale sul valore del tuo gioiello.</p>';
}
function woo_garanzia_tab_content() {
// The Garanzia tab content
echo '<h2>Garanzia e Reso</h2>';
echo '<p>Il gioiello è realizzato su misura per te da sapienti mani artigiane. Viene interamente prodotto in italia ed è garantito in ogni sua parte. Viene consegnato con un certificato che ne descrive le caratteristiche con timbro e firma GV Rings</p>';
echo '<p>Reso gratuito entro 14 giorni dalla data di acquisto secondo le normative europee. In caso di difetto o non conformità, conttattare info@gvcustomrings.com</p>';
}

/**
* Remove product data tabs
*/
add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 );

function woo_remove_product_tabs( $tabs ) {

unset( $tabs['additional_information'] ); // Remove the additional information tab

return $tabs;
}

error tabs woocommerce

Hi there,

I did it all with the code in thema’s function file.

Can you make sure this is added in the child theme's function.php?
Adding PHP: https://docs.generatepress.com/article/adding-php/

It's never a good idea to edit the parent theme's function.php file as it will be erased during updates.

The WooCommerce code is also not theme-specific, so if it works in a Twenty series WP theme, it would work in GeneratePress.

Hi Leo,

i haven't installed thema child yet because i'm doing tests.

Usually if I enable reviews from woocommerce settings, the tab in the product sheet and the possibility to write a review should be visible.

Now even if I enable the review from settings, it doesn't show up in the tab and I can't write reviews.

I don't understand where the mistake is.

I checked all the function file to see if by mistake I had deleted the reviews but everything is fine

is there any way to restore the original function file?

in this way I install the thema child and modify that.

or I can cancel adding code.

Would that be okay?

ok I solved problem!

activated review single product

Glad to hear :)

This archived topic is closed to new replies.