M
M
mUchenik2016-02-20 12:16:31
WordPress
mUchenik, 2016-02-20 12:16:31

How to add tab in woocommerce?

Friends, help me understand.
I'm trying to make additional tabs (TAV) in woocommerce.
I found a lesson and everything seems to be clear, but there are a number of questions.
Here is the link to the lesson itself: https://www.youtube.com/watch?v=VvLU89NBysM
The plugin is used there: "Manage WooCommerce Tabs Using filter"
I liked the plugin, but there is a problem, it does not display content and tabs on its own.
The lesson shows, using the example of adding a video, how to display it.
What have I done.
Here's the code I got:

add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 );
function woo_remove_product_tabs( $tabs ) {
 
 
//Переименовываю стандартные вкладки
   print_r ($tabs);
   $tabs ['description'] ['title'] = "Описание" ;
  
   $tabs ['reviews'] ['title'] = "Ваши отзывы" ;
 
 
   //Вывожу вкладку Видео
   $tabs['product_video'] = array(
            'title' => "Видео",
            'priority' => 20,
            'callback' => 'show_product_video'
        );
 
 
 
// Вывожу вкладку Технические характеристики
$tabs['Tehnicheskie_harakteristiki'] = array(
            'title' => "Техническик характеристики",
            'priority' => 25,
            'callback' => 'show_Tehnicheskie_harakteristiki'
        );
 
 
 
   return $tabs;
}
 
//Добавляю содержимое вкладки видео
 
function show_product_video() {
        //Grab video url
        $vid_url = get_field ('');
 
    $step1 =explode ('v=', $vid_url);
    $step2 =explode ('&amp', $step1[1]);
    $video_id = $step2[0];
 
    echo '<iframe width="420" height="315" src="https://www.youtube.com/embed/'. $video_id.'"frameborder="0"></iframe>';
 
}
 
 
// Добавляю содержимое вкладки Технические характеристики
 
function Tehnicheskie_harakteristiki() {
    $variable = get_field('field_name');
}

And of course, there were some problems:
1) The video is displayed on each card of the material, but not on each is played.
Here's what I want:
a) if in the created (with the help of the plugin) item (in my case "VIDEO" and "Technical characteristics") nothing is entered (no content), then these TAVs (tabs) should not be displayed on the page.
b) If there is information in the product card, in TAB, then it should be displayed exactly in the card in which I entered this information.
2) When trying to display the text, an error is generated:
Warning: call_user_func() expects parameter 1 to be a valid callback, function 'show_Tehnicheskie_harakteristiki' not found or invalid function name in /home/u596886390/public_html/wp-content/plugins/woocommerce/templates/single-product/tabs/tabs. php on line 42
I can't figure out what's wrong.
Here is the code for line #42
PHPHighlight Code
/* Enable support for Post Formats. */
    add_theme_support('post-formats', array('aside', 'image', 'video', 'quote', 'link'));

I also attach a link to the site:
dlyask.esy.es/tovar/chto-to-takoe
For your convenience (if necessary) a link with the ability to view the variables.
But if it is possible to make these TAVs without plugins, then I will only be glad if you tell me how to do it.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
vtormetall7, 2019-05-29
@vtormetall7

Here in these two articles everything is described how to add.
https://medved.online/individual-order-form-...
Tabs (tabs) for woo website card (Wordpress website)
https://medved.online/tabs-tabs-for-card-sa...

A
ashleemarri, 2021-11-05
@ashleemarri

With the help of WooCommerce Product Tabs plugin you can add Tabs to products. The tabs are displayed on the individual product pages to the right of the default “Description” tab. Please click on the link for the More details about this ploduct.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question