最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

WooCommerce, after moving reviews tab to under product description. If pagination link is clicked description is hidden

programmeradmin5浏览0评论

I used an unset $tab['reviews'] and added action to show reviews after product summary. It works great except for when people click on page 2 or 3 for comments. The pagination works, but then because of how reviews works, it hides the description until I click the tab for description.

Any ideas? Where does it tell that the description tab has to be hidden when reviews are paginated?

I used an unset $tab['reviews'] and added action to show reviews after product summary. It works great except for when people click on page 2 or 3 for comments. The pagination works, but then because of how reviews works, it hides the description until I click the tab for description.

Any ideas? Where does it tell that the description tab has to be hidden when reviews are paginated?

Share Improve this question asked Sep 1, 2018 at 21:45 DariusDarius 1171 silver badge12 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

The active tab is set in woocommerce/assets/js/frontend/single-product.js. Starting at line 11 this file looks for the words "comments" "reviews" or "tab-reviews" in the page url, and if found, it uses jQuery to click on the review tab. Since there is no review tab anymore, nothing gets clicked.

To solve this issue I overrode WooCommerce's single-product.js file by enqueue-ing a new js file under/after WC's single-product-min.js in the footer. I just copied the whole file into my theme and replaced "li.reviews_tab a" with "li.description_tab a" on lines 19 and 21. Not the most eloquent solution, but it worked for me.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论