[Resolved] Replace Summary Description Tabs From Single Product Woocommerce with Reviews &

Home Forums Support Replace Summary Description Tabs From Single Product Woocommerce with Reviews &

This topic contains 15 replies, has 3 voices, and was last updated by  Leo 3 days, 3 hours ago.

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #779538

    Yulia

    Hi, thanks you, guys, for all you support, so great.
    I got the situation.
    I need removing all the tabs on the Single Product Page and replacing it with the Description (area that can be edited with Visual Editor) and then right after it Reviews with form.
    I actually did it, here:
    http://footslove.smartleads.eu/product/add-your-heading-text-here/
    But I felt like the site became a bit slower after I did it. I suspect it’s the way I did it.
    So I used the hook to display reviews – it’s fine, but for the Tabs hiding I’ve used the https://ru.wordpress.org/plugins/woocommerce-jetpack/
    The question is how to compose a hook (if I got it right the gook of Single Product Description), so how to write so to replace those tabs with the Description and Reviews. Thanks.

    GeneratePress 2.2.1
    #779635

    Tom Lead Developer

    Hi there,

    How did you achieve it on the first site?

    The description is inside the tabs by default, right? If so, couldn’t we just do this?:

    .wc-tabs,
    #tab-description h2 {
        display: none;
    }
    #779737

    Yulia

    I thought it’s not SEO friendly as it duplicates the reviews.
    So I made it completely through the https://ru.wordpress.org/plugins/woocommerce-jetpack
    But it seems rather a heavy plugin (though may mistake), but it removes it completely. So I tried hooks like

    add_filter( ‘woocommerce_product_tabs’, ‘woo_remove_product_tabs’, 98 );

    function woo_remove_product_tabs( $tabs ) {
    unset( $tabs[‘description’] ); // Remove the description tab
    unset( $tabs[‘reviews’] ); // Remove the reviews tab
    unset( $tabs[‘additional_information’] ); // Remove the additional information tab
    return $tabs;
    }

    But somehow it doesn’t work (I’ve turned off the booster plugin so not to conflict) and I formatted codes properly as I’ve tried to create a hook for the search form and it works. It would be so great to have ability to replace it through Hooks.

    #780057

    Tom Lead Developer

    Doing this along with the CSS I provided doesn’t work?:

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

    That should remove the reviews, but keep the description.

    #780088

    Yulia

    Ah, Mensh, I forgot the php checkbox(and Custom Hook Name)! Arr, thank you, Tom.
    But still, this code washed out all the Tabs entirely(I DID paste your code with the third line errased)! 🙂 And funny thing, till I didn’t set the Draft Status on the Element nothing could return those poor Tabs, few, thought I killed them forever.
    So this is the right path. Okay, may be now I just need a hook for displaying the Description, just like I’ve displayed the Reviews earlier?
    Or may be some set() function instead of unset?

    #780107

    Yulia

    I DID it! This code indeed removes all the Tabs despite the unset function(weird logic). The person here:
    https://stackoverflow.com/questions/30811930/how-to-remove-woocommerce-tab
    explains how to display the Description later.
    His code misses ' and uses actioninstead of filter– so I will give here the valid one:

    <?php 
    add_filter( 'woocommerce_single_product_summary',  'woocommerce_template_product_description', 40 );
    function woocommerce_template_product_description() {
       woocommerce_get_template( 'single-product/tabs/description.php' );
    }
    
    ?>

    And now it works like a charm, alliluya indeed.

    #780114

    Yulia

    Noticed the issue with the css – it feels like Reviews overlapping now the Description area, like sort of Description doesn’t have clear:both property or something. The last thing to conquer and it’s done.
    (will return to the previous version meanwhile, couse the client may check and be confused)
    Though the speed is skyrocket again with those hooks

    #780120

    Yulia

    Won the issue of the Reviews by choosing another Hook:
    woocommerce_after_main_content
    The issue about the floating kinda persists. It’s not crucial that much, so leaving the buggy version to investigate, thanks!

    #780123

    Yulia

    Ohh, another Hook mistake – now perfect!
    So the correct code to display the Description and then Reviews would be:

    <?php 
    add_filter( 'woocommerce_single_product_summary',  'woocommerce_template_product_description_reviews', 40 );
    function woocommerce_template_product_description_reviews() {
       woocommerce_get_template( 'single-product/tabs/description.php' );
    	comments_template();
    }
    
    ?>
    #780162

    Yulia

    woocommerce_after_main_content can’t be as related products display right after summary.
    So it’s woocommerce_single_product_summary, but then this issue – when the fist element in the visual editor becomes narrow – this can be conquered, but the Review area also – here http://footslove.smartleads.eu/product/add-your-heading-text-here/

    #780183

    Yulia

    Haha, silly me, no, can you imagine, that same filter and can’t invent it.
    So simple:

    <?php 
    add_filter( 'woocommerce_product_tabs',  'woocommerce_template_product_description_reviews', 40 );
    function woocommerce_template_product_description_reviews() {
       woocommerce_get_template( 'single-product/tabs/description.php' );
    	comments_template();
    }
    
    ?>

    Now, all issues resolved in a natural way!

    #780190

    Yulia

    With this solution Reviews are ok, Related Products are also good – located properly, but still one slight thing remains – the first element in the editor overlaps the entire product and untill that element not z-index negative like z-index:-8; this element messes with the control buttons and doesn’t allow to hit them. So any ideas will be highly appreciated to understand the concept – why this happens and how to avoid without pasting artificially each time that code.

    #780196

    Yulia

    Okk, now know everything. That is a woocommerce markup. So, to avoid that constant trick:

    <?php 
    add_filter( 'woocommerce_product_tabs',  'woocommerce_template_product_description_reviews', 40 );
    function woocommerce_template_product_description_reviews() {
    	echo("<div style='clear:both' class='remove-h2'></div>");
       woocommerce_get_template( 'single-product/tabs/description.php' );
    	comments_template();
    }
    
    ?>
    .remove-h2 +h2
    {
    	display: none;
    }
    #780282

    Leo Customer Support

    So this is all good now?

    If so glad you figured out 🙂

    #780521

    Yulia

    Yes, Leo, thanks, works like a charm and the most important – preserving the speed of GP. Very happy with it.

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

The topic ‘Replace Summary Description Tabs From Single Product Woocommerce with Reviews &’ is closed to new replies.