Product tabs disappear when there’s not a video
-
Hi, i tried your plugin, but when it is activated then my custom product tabs get disappear in my template product page. IMHO the plugin is using the
woocommerce_product_tabs
filter without returning any tabs if there’s not any videos defined for the product.To fix this issue, I suggest you to edit the functions/functions-primary.php file at line 470 like this:
// create the video for the product page if (!function_exists ('api_pv_video_tab')) { add_filter('woocommerce_product_tabs', 'api_pv_video_tab'); function api_pv_video_tab($tabs) { // get the tab information from settings $product_id = get_the_ID(); $plugin_options = wp_parse_args(get_option('api_pv_options'), api_pv_default_options()); $hide_video_tab = sanitize_text_field($plugin_options['api_pv_hide_video_tab']); // get the currently displayed videos $video_urls_manual = api_pv_get_video_urls($product_id, 'manual'); $video_urls_manual_count = count($video_urls_manual); $video_urls = api_pv_get_video_urls($product_id, 'imported'); $video_urls_count = count($video_urls); $total_videos = $video_urls_manual_count + $video_urls_count; if (is_array($video_urls) || is_array($video_urls_manual)) { if (!empty($video_urls) || !empty($video_urls_manual)) { if ($hide_video_tab !== '1') { $tab_name = sanitize_text_field($plugin_options['api_pv_tab_name']); if ($tab_name == '') { $tab_name = 'Videos'; } $tab_priority = sanitize_text_field($plugin_options['api_pv_tab_priority']); if ($tab_priority == '') { $tab_priority = 30; } $tabs['api_pv_video_tab'] = array( 'title' => __($tab_name, 'woocommerce'), 'priority' => $tab_priority, 'callback' => 'api_pv_video_tab_content' ); return $tabs; } } } return $tabs; } }
thank you
- The topic ‘Product tabs disappear when there’s not a video’ is closed to new replies.