Home › Forums › Support › Replace Summary Description Tabs From Single Product Woocommerce with Reviews &
- This topic has 15 replies, 3 voices, and was last updated 7 years, 2 months ago by
Leo.
-
AuthorPosts
-
January 11, 2019 at 2:13 pm #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.January 11, 2019 at 6:33 pm #779635Tom
Lead DeveloperLead DeveloperHi 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; }January 12, 2019 at 1:00 am #779737Yulia
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 likeadd_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.
January 12, 2019 at 8:28 am #780057Tom
Lead DeveloperLead DeveloperDoing 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.
January 12, 2019 at 9:17 am #780088Yulia
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?January 12, 2019 at 9:55 am #780107Yulia
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 usesactioninstead offilter– 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.
January 12, 2019 at 10:08 am #780114Yulia
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 hooksJanuary 12, 2019 at 10:14 am #780120Yulia
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!January 12, 2019 at 10:16 am #780123Yulia
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(); } ?>January 12, 2019 at 11:24 am #780162Yulia
woocommerce_after_main_contentcan’t be as related products display right after summary.
So it’swoocommerce_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/January 12, 2019 at 11:48 am #780183Yulia
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!
January 12, 2019 at 12:03 pm #780190Yulia
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.January 12, 2019 at 12:15 pm #780196Yulia
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; }January 12, 2019 at 3:46 pm #780282Leo
StaffCustomer SupportSo this is all good now?
If so glad you figured out 🙂
January 13, 2019 at 4:02 am #780521Yulia
Yes, Leo, thanks, works like a charm and the most important – preserving the speed of GP. Very happy with it.
-
AuthorPosts
- The topic ‘Replace Summary Description Tabs From Single Product Woocommerce with Reviews &’ is closed to new replies.