Home Forums WoodMart support forum Woocomerce custom tab error

Woocomerce custom tab error

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #130712

    Anonymous
    Inactive

    Hi, I have added a new tab for a product in the custom tab option for a product. ‘ nutritional information’

    I used the reorder PHP from woocomerce to reorder my tabs which works ok on the page where the tab is active. However, on the pages where nutritional information is not displayed an error message appears.
    Warning: call_user_func() expects parameter 1 to be a valid callback, no array or string given in /home/natu1091/public_html/wp-content/themes/woodmart/woocommerce/single-product/tabs/tabs.php on line 51

    Would you be able to provide the code to display that order only when the woomdart custom tab is shown?

    Kind regards, Ciaran

    #130724

    Artem Temos
    Keymaster

    Hello,

    What kind of code have you used for this task?

    Regards

    #131293

    Anonymous
    Inactive

    Hi, I used the following PHP snippet

    /**
    * Reorder product data tabs
    */
    add_filter( ‘woocommerce_product_tabs’, ‘woo_reorder_tabs’, 98 );
    function woo_reorder_tabs( $tabs ) {

    $tabs[‘decription’][‘priority’] = 5; // Reviews first
    $tabs[‘woodmart_custom_tab’][‘priority’] = 10; // Description second
    $tabs[‘additional_information’][‘priority’] = 15; // Additional information third

    return $tabs;
    }

    The problem is on pages with no description or woodmart custom tab the following error is displayed.

    Warning: call_user_func() expects parameter 1 to be a valid callback, no array or string given in /home/natu1091/public_html/wp-content/themes/woodmart/woocommerce/single-product/tabs/tabs.php on line 51

    #131294

    Artem Temos
    Keymaster

    The code seems to be not correct. Check how it should look from the official WooCommerce documentation https://docs.woocommerce.com/document/editing-product-data-tabs/#section-3

Viewing 4 posts - 1 through 4 (of 4 total)