New Landing How can we help? Atelier Hide empty description tab & messy add to cart product page

Viewing 15 posts - 1 through 15 (of 16 total)
  • Posted in: Atelier
  • #228190
    buckie
    Member
    Post count: 71

    Hi,

    1. Regarding hiding the description tab on the product page, I have placed the following code in my child themes functions.php:

        add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 );
        
        function woo_remove_product_tabs( $tabs ) {
            $tabs['description']['priority'] = 50;
            //$tabs['description']['title'] = __( 'More Information' );
            
            return $tabs;
        }
    

    But unfortunately it only places the tab below the other tabs and not hides it. See screenshot.
    On my site not all description tabs are empty, so a complete removal is not wanted.
    Could you help me with a better code?

    2. Regarding the buttons for add to cart and wishlist on the product page, if the page is presented on a small screen, the buttons don’t line up nicely. Please have a look at my screenshot.
    Any ideas on that?

    Thank you.
    Buckie.

    Attachments:
    You must be logged in to view attached files.
    #228897
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please use this code to remove the tab.

    add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 );
    function woo_remove_product_tabs( $tabs ) {
    unset( $tabs['description'] );      	// Remove the description tab
    return $tabs;
    }

    Thanks
    Mohammad

    #228903
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please use also this code for second issue:-

    
    @media only screen and (max-width: 767px) {
    button.single_add_to_cart_button {
    padding: 0px 6px !important;
    font-size: 9px !important;
    margin: 0px !important;
    }
    div.quantity{
    margin:0px 1px 0px 0px !important;
    }
    }
    

    Thanks
    Mohammad

    #228934
    buckie
    Member
    Post count: 71

    Hi Mohammed,

    Thank you, but unfortunately it didn’t help.

    1. This code hides all description tabs, even if it has content. Is it possible to have the tabs hidden only when no content is there?
    2. The layout is still messy. Please have a look at my site.

    Thanks!
    Buckie

    PS. I’ve cleared my cache.

    #228936
    buckie
    Member
    Post count: 71
    This reply has been marked as private.
    #228953
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please remove the last code and try to use this code:-

    add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 );
    function woo_remove_product_tabs( $tabs ) {
    $product_description = sf_get_post_meta($post->ID, 'sf_product_description', true);
    if ($product_description == "") {
    unset( $tabs['description'] );      	// Remove the description tab
    }
    return $tabs;
    }
    

    Thanks
    Mohammad

    #228998
    buckie
    Member
    Post count: 71

    Unfortunately it still removes the tab with content.
    Any other suggestions?

    Buckie.

    #229001
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please remove my last code and use this new code:-

    add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 );
    function woo_remove_product_tabs( $tabs ) {
    global $post;
    $product_description = sf_get_post_meta($post->ID, 'sf_product_description', true);
    if ($product_description == "") {
    unset( $tabs['description'] );      	// Remove the description tab
    }
    return $tabs;
    }
    

    Thanks
    Mohammad

    #229003
    buckie
    Member
    Post count: 71

    Works like a charm! Thank you!!
    Any ideas on my second issue?

    Buckie.

    #229004
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please use this code for your second issue.

    
    @media only screen and (max-width: 767px) {
    button.single_add_to_cart_button {
    padding: 0px 6px !important;
    font-size: 9px !important;
    margin: 0px !important;
    }
    div.quantity{
    margin:0px 1px 0px 0px !important;
    }
    }

    Thanks
    Mohammad

    #229012
    buckie
    Member
    Post count: 71
    This reply has been marked as private.
    #229017
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Whats your screen size?
    Thanks
    Mohammad

    #229019
    buckie
    Member
    Post count: 71

    Hi,

    This problem occurs in screen sizes between approx. 765px and 1190px.
    Hope this helps. I’ve already tried your css code with the max-width on 1024px, but it didn’t help.

    Thanks.
    Buckie.

    #229022
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please try to use this code:-

    @media only screen and (min-width:767px) and (max-width: 1190px)  {
    button.single_add_to_cart_button {
    padding: 0px 6px !important;
    font-size: 9px !important;
    margin: 0px !important;
    }
    div.quantity{
    margin:0px 1px 0px 0px !important;
    }
    }

    Thanks
    Mohammad

    #229338
    buckie
    Member
    Post count: 71

    Hi Mohammad,

    I kept having problems with your code, so I made it work with following css:

    /* To resolve messy add to cart buttons on product page */
    @media only screen and (min-width:767px) and (max-width: 1190px)  {
    form.cart { margin-bottom:0;}
    .woocommerce div.product form.cart div.quantity{margin-bottom:20px !important;}
    .woocommerce form.cart button.add_to_cart_button{margin-bottom:20px !important; margin-right: 20px !important;}
    .woocommerce form.cart .yith-wcwl-add-to-wishlist{margin: 0 !important;}
    }

    Do you think it could cause problems or is it okay?

    Thank you!
    Buckie.

Viewing 15 posts - 1 through 15 (of 16 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register