Home Forums WoodMart support forum HIDE TAB IF IS EMPTY

HIDE TAB IF IS EMPTY

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #369444

    WEBMAZE
    Participant

    Dear 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

    #369573

    Aizaz Imtiaz Awan
    Keymaster
    Xtemos team

    Hello,

    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

    #369574

    WEBMAZE
    Participant

    Dear 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_tab

    Can your developer tell me the values of your TABS

    wd_additional_tab_tab

    wd_additional_tab_2_tab

    wd_additional_tab_3_tab

    THANKS

    #369682

    Artem Temos
    Keymaster
    Xtemos team

    Your 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.

    #369683

    WEBMAZE
    Participant

    Dear 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 ”

    #369684

    Artem Temos
    Keymaster
    Xtemos team

    But 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' )

    #369687

    WEBMAZE
    Participant

    Dear 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 empty

    the 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 want

    #369692

    WEBMAZE
    Participant

    For example

    “unset( $tabs[‘reviews’] );” its working

    or “unset( $tabs[‘wd_additional_tab_2_tab’] );” its not working

    #369693

    Artem Temos
    Keymaster
    Xtemos team

    Try to use the following list of keys for the unset function

    wd_additional_tab
    wd_additional_tab_2
    wd_additional_tab_3

    Kind Regards

    #369893

    WEBMAZE
    Participant

    Hi
    Thank you
    Its working perfect

    #369924

    Artem Temos
    Keymaster
    Xtemos team

    Great, you are welcome!

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

The topic ‘HIDE TAB IF IS EMPTY’ is closed to new replies.