Adding Custom Tab in Functions.php - by thisisbolo

This topic has 6 replies, 3 voices, and was last updated 4 years, 11 months ago ago by John Holden

  • Avatar: thisisbolo
    thisisbolo
    Participant
    December 2, 2019 at 23:09

    Adding a custom tab via https://docs.woocommerce.com/document/editing-product-data-tabs/ doesn’t seem be working. Is there another filter that should be used? I am using the Single Product Builder.

    I’ll be altering to show/hide a tab based on product category.

    
    /*** 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 'Here\'s your new product tab.
    ';	
    }
    5 Answers
    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    December 3, 2019 at 11:15

    Hello,

    1) There are 2 custom tabs already available for your products + 1 custom tab individual for every product http://prntscr.com/q5hkyl Is it not enough for you?

    2) If you still need more tab then add priority to your filter params, for example
    add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab', 99 );

    Regards

    Avatar: thisisbolo
    thisisbolo
    Participant
    December 11, 2019 at 04:48

    Hi,

    Thanks. This’ll give me some flex. I see there are 2 custom tabs available for products & 1 custom tab individual for every product. In the single product builder, there’s no option to add content to the 1 custom tab individual. Only allowance for 2 custom tabs.

    Where is the 3rd tab? https://prnt.sc/q947m5

    Avatar: John Holden
    John Holden
    Support staff
    December 11, 2019 at 05:42

    Hi,

    Custom Tab Individual you can edit inside single product https://screencast-o-matic.com/watch/cqlXfCUSBj

    Regards,
    Hung PD

    Avatar: thisisbolo
    thisisbolo
    Participant
    December 11, 2019 at 18:23

    Oh, I see! It’s at the edit product level. That’s helpful. Thank you for clarifying Hung. I don’t know why I didn’t look there!

    Cheers.

    Avatar: John Holden
    John Holden
    Support staff
    December 12, 2019 at 04:54

    Hi,

    Glad to hear your issue has been resolved.

    If you have a quick minute we always appreciate a 5-star rating on our theme!

    https://themeforest.net/item/xstore-responsive-woocommerce-theme/reviews/15780546

    Your feedback is the motivation to improve our work and services.

    Regards,
    Hung PD

  • Viewing 6 results - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.Log in/Sign up

8theme customization service
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.