Wanting to remove the stars badge in the review section of a Shopify store when there are 0 reviews for the product. The goal is to have the badge appear automatically once a review is received. Here's the code snippet:
HTML
<div class="spr-badge-container">
<span class="stamped-product-reviews-badge stamped-main-badge" data-id="{{ product.id }}" data-product-sku="{{ product.handle }}" data-product-type="{{product.type}}" data-product-title="{{product.title}}" style="display: inline-block;">{{ product.metafields.stamped.badge }}</span>
</div>
CSS
.stamped-container[data-count="0"][data-version="2"] {
display:none !important;
}
The above CSS hides the star ratings inside the "spr-badge-container". My aim is to hide the entire "spr-badge-container" DIV if the enclosed SPAN element is hidden.
I've attempted different approaches without success. Any suggestions or an easier solution would be greatly appreciated.
Thank you, J
P.S. This is the HTML rendered by the browser:
HTML for review stars section
<div class="spr-badge-container review-margin-cust">
... (omitted for brevity) ...
</div>
HTML for main reviews section
<div class="stamped-container" data-count="0" data-widget-style="standard2" data-widget-language=""
... (omitted for brevity) ...
</div>
Additionally, here is the complete CSS for hiding these elements:
CSS
#stamped-main-widget .stamped-container[data-count="0"] { display: none !important; }
.stamped-container[data-count="0"][data-version="2"] { display:none !important; }