Archived topic
Generatepress + Woocommerce Editing Product Tab
2 replies · Started by Giovanni on December 21, 2021
Hi all,
I no longer know which way to take. :-(
I followed woocommerce instructions to add and edit product Tabs.
If I follow the woocommerce instructions I can only insert a Tab because from the second on it gives me an error.
Incomplete instructions sadly and I had to do a lot of research to figure out what to do since I'm not a programmer.
I couldn't add more than one Tab with the woocommerce scheme.
Now I have found the right scheme that makes me insert more Tabs but unfortunately, the second description is not visible.
There are 3 tabs:
Description
Payment
Times
The text of the description and times tab is visible while the payment tab is not.
Why?
This is what i placed on my function file:
/**
* 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['attrib_desc_tab'] = array(
'title' => __( 'Tempi', 'woocommerce' ),
'priority' => 100,
'callback' => 'woo_tempi_tab_content'
);
// Adds the Pagamento tab
$tabs['test_tab'] = array(
'title' => __( 'Pagamento', 'woocommerce' ),
'priority' => 120,
'callback' => 'woo_pagamento_content'
);
return $tabs;
}
// New Tab contents
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_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>';
}
These are the indications of woocommerce:
/**
* Add a custom product data tab
*/
add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab' );
function woo_new_product_tab( $tabs ) {
// Adds the new tab
$tabs['test_tab'] = array(
'title' => __( 'New Product Tab', 'woocommerce' ),
'priority' => 50,
'callback' => 'woo_new_product_tab_content'
);
return $tabs;
}
function woo_new_product_tab_content() {
// The new tab content
echo '<h2>New Product Tab</h2>';
echo '<p>Here\'s your new product tab.</p>';
}
Hi,
Now is correct code!
/**
* 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'
);
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>';
}
Hi there,
glad to hear you found the answer you were looking for!