Skip to content

Instantly share code, notes, and snippets.

@gstricklind
Last active March 9, 2019 20:51
Show Gist options
  • Save gstricklind/13e2f4ba5ff2b39bca9415d4908fee18 to your computer and use it in GitHub Desktop.
Save gstricklind/13e2f4ba5ff2b39bca9415d4908fee18 to your computer and use it in GitHub Desktop.
Add Write A Review link to woocommerce product pages
//https://ginastricklind.com/how-to-add-write-your-review-link-to-woocommerce-product-page/
(function($){
$('.woocommerce-product-rating .woocommerce-review-link').after(' | <a class="write-your-review" href="#tab-reviews">Write Your Review</a>');
$('.write-your-review').click( function () {
$('.tabs li').removeClass('active');
$('.woocommerce-Tabs-panel').attr("style", "display:none");
$('.reviews_tab').addClass('active');
$('.woocommerce-Tabs-panel--reviews').attr("style", "display:block");
$('html, body').animate({
scrollTop: $("#commentform").offset().top -200
}, 1500);
});
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment