I am learning WooCommerce development. I would like to display the stars rating at top of the heading so I tried like this (Not a review, it's just an example):
function action_woocommerce_single_product_review() {
//I don't want to show any content here
}
add_action( 'woocommerce_single_product_summary', 'action_woocommerce_single_product_review', 1, 0 );
I also tried using jQuery which is working:
$(".woocommerce-product-rating").insertBefore('.product_title');
My Answer:
However, it is recommended to use CSS to move the stars rating instead of using jQuery. You can add the following CSS code to your theme's style.css file:
css
.single-product .woocommerce-product-rating {
margin-bottom: 20px;
}
.single-product .product_title {
margin-top: 20px;
}
This will move the stars rating above the product title on the single product page.
Rate this post
3 of 5 based on 7493 votesComments