• Resolved danilocdf

    (@danilocdf)


    Hi,

    I’m using this plugin to show a custom enquiry tab (contact7 form) and it’s working pretty good.

    Problems comes when I try to display it as I display the whole page, I use this code in my theme’s function

    function remove_woocommerce_product_tabs( $tabs ) {
    	unset( $tabs['description'] );
    	unset( $tabs['reviews'] );
    	unset( $tabs['additional_information'] );
    	return $tabs;
    }
    add_filter( 'woocommerce_product_tabs', 'remove_woocommerce_product_tabs', 98 );
    
    /**
     * Hook in each tabs callback function after single content.
     */
    add_action( 'woocommerce_after_single_product', 'woocommerce_product_description_tab' );
    add_action( 'woocommerce_after_single_product', 'woocommerce_product_additional_information_tab' );

    So tabs are dispayed and opened in the page.
    I can’t find the hook I need to add to display also the custom tab in “woocommerce_after_single_product” and I also can’t actually remove it like I’ve done with other tabs.

    Any help will be very appreciated.

    Thank you

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author WPBean

    (@wpbean)

    Hi,

    You can remove the custom tabs by adding code like bellow –
    You need to put the custom tab / post id. If you go to tab edit page or hover over the edit link of the tab you can see the post ID.

    function remove_woocommerce_product_tabs( $tabs ) {
    	unset( $tabs['665'] );
    	return $tabs;
    }
    add_filter( 'woocommerce_product_tabs', 'remove_woocommerce_product_tabs', 98 );
    Plugin Author WPBean

    (@wpbean)

    And add the code like bellow for adding custom tab content after single product content
    Post id is the tab.

    function add_woocommerce_custom_tab_content(  ) {
    	$my_postid = 665;
    	$content_post = get_post($my_postid);
    	$content = $content_post->post_content;
    	$content = apply_filters('the_content', $content);
    	$content = str_replace(']]>', ']]>', $content);
    	echo $content;
    }
    add_filter( 'woocommerce_after_single_product', 'add_woocommerce_custom_tab_content', 98 );
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom Tab Hook’ is closed to new replies.