Ecommerce Shopify WordPress Discussion

Custom Star Rating option in woocommerce [closed]

Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 6 days ago. Improve this question i am working on one woocommerce project and in that project i created quick view user can see product quick view now i want give option to user to add rating from quick view modal so please let me know how can i add custom star rating option in quick view modal. I did not try anything here is my code of quick view modal, function quick_view_modal(){ if (isset($_POST['dataId'])) {?> <?php $dataId = $_POST['dataId']; ?> <?php $product_info = wc_get_product( $dataId ); print_r($product_info); ?> <!-- Quick View Modal Box Start --> <div class="modal fade theme-modal view-modal" id="view" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true" > <div class="modal-dialog modal-dialog-centered modal-xl modal-fullscreen-sm-down"> <div class="modal-content"> <div class="modal-header p-0"> <h5 class="modal-title">Quick View</h5> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" > <i class="fa-solid fa-xmark"></i> </button> </div> <div class="modal-body"> <div class="row g-sm-4 g-2"> <div class="col-lg-6"> <div class="slider-image"> <?php $image = wp_get_attachment_image_src( $product_info->image_id, 'full' ); ?> <img src="<?php echo $image[0]; ?>" class="img-fluid blur-up lazyload" alt="" /> </div> </div> <div class="col-lg-6"> <div class="right-sidebar-modal"> <h4 class="title-name"><?php $product_name = $product_info->name; echo $product_name; ?></h4> <h4 class="price">$<?php $price = $product_info->regular_price; echo $price; ?></h4> <div class="product-rating"> <!-- <ul class="rating"> <?php echo $product_info->get_rating_html();?> <li> <i data-feather="star" class="fill"></i> </li> <li> <i data-feather="star" class="fill"></i> </li> <li> <i data-feather="star" class="fill"></i> </li> <li> <i data-feather="star" class="fill"></i> </li> <li> <i data-feather="star"></i> </li> </ul> --> <ul class="rating"> <?php $rating = $product_info->get_average_rating(); // Assuming get_average_rating() is a method to get the average rating of the product $review_count = $product_info->review_count; // Assuming get_review_count() is a method to get the review count of the product $max_stars = 5; // Maximum number of stars // Loop to generate stars based on the average rating for ($i = 1; $i <= $max_stars; $i++) { if ($i <= $rating) { // Filled star echo '<li><i data-feather="star" class="fill"></i></li>'; } else { // Empty star echo '<li><i data-feather="star"></i></li>'; } } ?> </ul> <span class="ms-2"><?php $review_count = $product_info->review_count; echo $review_count; ?> Reviews</span> <span class="ms-2 text-danger" ><?php $total_sales = $product_info->total_sales; echo $total_sales?> sold in last 16 hours</span > </div> <div class="product-detail"> <h4>Product Details :</h4> <p> <?php $product_description = $product_info->description; echo $product_description; ?> <!-- Embrace summery sophistication with our White Crop Top. This chic and versatile piece is designed for the modern fashionista, featuring a flattering crop cut that effortlessly pairs with high-waisted bottoms. The crisp white hue adds a touch of freshness to your look, making it a go-to choice for warm-weather style. Whether you're heading to brunch or a night out, this crop top exudes effortless charm, making it a key player in your fashionable wardrobe rotation. --> </p> </div> <ul class="brand-list"> <li> <div class="brand-box"> <h5>Brand Name:</h5> <h6>Black Forest</h6> </div> </li> <li> <div class="brand-box"> <h5>Product Code:</h5> <h6>W0690034</h6> </div> </li> <li> <div class="brand-box"> <h5>Product Type:</h5> <h6>Crop Top</h6> </div> </li> </ul> <div class="modal-button"> <button class="btn btn-md add-cart-button icon" onclick="addToCartAndUpdateCount(<?php echo $product_info->id; ?>);"> Add To Cart </button> <?php $product_url = $product_info ? get_permalink($dataId) : '';?> <a href="<?Php echo $product_url;?>" class="btn theme-bg-color view-button icon text-white fw-bold btn-md"> View More Details </a> </div> <span class="Added">Product added to cart successfully</span> </div> </div> </div> </div> </div> </div> </div> <!-- Quick View Modal Box End --> <?php } die(); // This is important to end the PHP script after processing the AJAX request }
TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.