Home › Forums › WoodMart support forum › HIDE TAB IF IS EMPTY
HIDE TAB IF IS EMPTY
- This topic has 10 replies, 3 voices, and was last updated 3 years ago by
Artem Temos.
-
AuthorPosts
-
April 19, 2022 at 3:20 pm #369444
WEBMAZEParticipantDear sir
I use the 3 tabs option in in single product that I field them with HTML blocks and they working perfect.
I wan to know how I can hide the tabs (one by one check) in case that is empty.
If you help with one I can do the others.
The HTML block that I used call ACF valeus….so I need code to check if someone ACF is empty , not to allow to display the TABS (TAYTOTHTA – SYSTATIKA -DOSOLOGIA)https://petbaba.gr/product/dermatosis-rabbit-dog-12-kg-2/
this product is full with values TABS (TAYTOTHTA – SYSTATIKA -DOSOLOGIA)https://petbaba.gr/product/animal-odor-eliminator-250-ml/
this product has no values TABS (TAYTOTHTA – SYSTATIKA -DOSOLOGIA)Thanks in advance
April 20, 2022 at 9:54 am #369573
Aizaz Imtiaz AwanKeymasterHello,
Sorry but there is no option in Theme Settings available for that.
It requires customizations and this is beyond our limitations and support policy.
Best Regards
April 20, 2022 at 9:56 am #369574
WEBMAZEParticipantDear sir
I found how do it
These is the code, that hide the “revue” tab in case that one of my ACF values is empty..
Is working with different cases./** Remove Woocommerce review tab if an ACF value is empty */
add_filter( ‘woocommerce_product_tabs’, ‘delete_tab’, 920 );
function delete_tab( $tabs ) {global $product;
$id = $product->id;$args = array (‘post_type’ => ‘product’, ‘post_id’ => $id);
$comments = get_field(‘dosologia’);if(empty($comments)) {
unset( $tabs[‘reviews’] );
}return $tabs;
}The problem is that I can NOT find the “3 TABS VALUE” that your system produce to fill this ———–unset( $tabs[‘reviews’] );—————-
I tried everything like…
wd_additional_tab_tab
tab-title-wd_additional_tab
tab-wd_additional_tab
#tab-wd_additional_tabCan your developer tell me the values of your TABS
wd_additional_tab_tab
wd_additional_tab_2_tab
wd_additional_tab_3_tab
THANKS
April 20, 2022 at 3:47 pm #369682
Artem TemosKeymasterYour custom tabs always have some HTML blocks so we can’t check if they are empty. Sorry, but we don’t have a code for such a case.
April 20, 2022 at 3:52 pm #369683
WEBMAZEParticipantDear sir
Idont want you to check somethink
I ask for something very simple” Can your developer tell me the values of your TABS
wd_additional_tab_tab
wd_additional_tab_2_tab
wd_additional_tab_3_tab ”
April 20, 2022 at 3:54 pm #369684
Artem TemosKeymasterBut will never be empty because you have HTML blocks there. Anyway, here is the code that returns the value
woodmart_get_opt( 'additional_tab_3_html_block' )
April 20, 2022 at 4:02 pm #369687
WEBMAZEParticipantDear sir
If you see the code is not checking if the HTML blocks are empty or not
Check a value of an ACF if its emptythe problem is the vallue that i have to put in the place of “reviews” ————
“unset( $tabs[‘reviews’] );”The value of 3tabs
This is what I wantApril 20, 2022 at 4:26 pm #369692
WEBMAZEParticipantFor example
“unset( $tabs[‘reviews’] );” its working
or “unset( $tabs[‘wd_additional_tab_2_tab’] );” its not working
April 20, 2022 at 4:32 pm #369693
Artem TemosKeymasterTry to use the following list of keys for the
unset
functionwd_additional_tab wd_additional_tab_2 wd_additional_tab_3
Kind Regards
April 21, 2022 at 12:05 pm #369893
WEBMAZEParticipantHi
Thank you
Its working perfectApril 21, 2022 at 2:08 pm #369924
Artem TemosKeymasterGreat, you are welcome!
-
AuthorPosts
The topic ‘HIDE TAB IF IS EMPTY’ is closed to new replies.
- You must be logged in to create new topics. Login / Register