Skip to content

Instantly share code, notes, and snippets.

Created August 3, 2016 22:37
What would you like to do?
WooCommerce - Smooth scrolls to the review tab and makes it active
add_action( 'woocommerce_after_single_product', 'activate_review_tab' );
function activate_review_tab() {
echo '<script>
jQuery(document).ready(function ($) {
var currentTab = $(this).attr("href");
$(".woocommerce-tabs .panel").hide();
$(".woocommerce-tabs li").removeClass("active");
$("html, body").animate({
scrollTop: $(".woocommerce-tabs").offset().top
}, 1000);
return false;
// Add code to your-child-theme/woocommerce/single-product/rating.php
echo '<a id="add_review" href="#tab-reviews">Add a review</a>';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment