Home / Forums / WoodMart support forum / wd_custom_tab priority
Home › Forums › WoodMart support forum › wd_custom_tab priority
wd_custom_tab priority
- This topic has 3 replies, 2 voices, and was last updated 2 years, 1 month ago by
Luke Nielsen.
-
AuthorPosts
-
June 12, 2024 at 8:13 pm #572334
FreeRiderNSKParticipantHello!
How to change the tab “wd_custom_tab” priority correctly if it is applied to a product?
I did this but got an error in the “query monitor” plugin:add_filter( 'woocommerce_product_tabs', 'woo_reorder_tabs', 98 ); function woo_reorder_tabs( $tabs ) { $my_tab = $tabs['wd_custom_tab']['title']; if ( !empty($my_tab) ) { $tabs['wd_custom_tab']['priority'] = 45; // Кастомная вкладка товара первая return $tabs; } else { return $tabs; } }How to do it right?
-
This topic was modified 2 years, 1 month ago by
FreeRiderNSK.
-
This topic was modified 2 years, 1 month ago by
FreeRiderNSK.
June 13, 2024 at 9:44 am #572409
Luke NielsenMemberHello,
Try to use the code below instead of yours. Define the code in the functions.php file in your child theme.
/** * Reorder product data tabs */ add_filter( 'woocommerce_product_tabs', 'woo_reorder_tabs', 98 ); function woo_reorder_tabs( $tabs ) { $tabs['reviews']['priority'] = 5; // Reviews first $tabs['description']['priority'] = 10; // Description second $tabs['additional_information']['priority'] = 15; // Additional information third // Custom Tabs are from Product Settings // $tabs['wd_custom_tab']['priority'] = 2; // $tabs['wd_custom_tab_2']['priority'] = 3; // Additional Tabs are from Theme Settings // $tabs['wd_additional_tab']['priority'] = 4; // $tabs['wd_additional_tab_2']['priority'] = 5; return $tabs; }Kind Regards
June 13, 2024 at 6:30 pm #572599
FreeRiderNSKParticipantHi!
I wouldn’t write to you just like that.
This causes a bug if the product doesn’t have “wd_custom_tab”.
But then the second tab is not active by default, you need to click on it.
I need “wd_custom_tab” first when it is filled in for the product!
Please see screenshot.PS
To make it work the way I want, I have to change the priority in the file.
\woodmart\inc\integrations\woocommerce\functions.phpI need a code with a condition. For function.php child theme.
If “wd_custom_tab” is filled, then change the priority to 1.Attachments:
You must be logged in to view attached files.June 14, 2024 at 5:35 pm #572860
Luke NielsenMemberHello,
Try to use the code below in this case:
/** * Reorder product data tabs */ add_filter( 'woocommerce_product_tabs', 'woo_reorder_tabs', 98 ); function woo_reorder_tabs( $tabs ) { $tabs['reviews']['priority'] = 5; // Reviews first $tabs['description']['priority'] = 10; // Description second $tabs['additional_information']['priority'] = 15; // Additional information third if ( !empty($tabs['wd_custom_tab']) ) { $tabs['wd_custom_tab']['priority'] = 2; } return $tabs; }Kind Regards
-
This topic was modified 2 years, 1 month ago by
-
AuthorPosts
- You must be logged in to create new topics. Login / Register