Skip to main content

Rating Bar

A full-width strip with stars, rating, review count and an optional logo.

The 5zero Rating Bar is a horizontal strip with stars, the rating and the review count, like ★★★★★ 4.8 based on 2,341 reviews, and an optional logo.

Where to place it

  1. Homepage
  2. Landing pages
  3. Header
  4. Footer

Adding it to your theme

  1. In the Theme Editor, open the template, for example the homepage.
  2. Click Add block in a section and choose 5zero Rating Bar from the Apps tab.
  3. Pick the Review scope: All reviews, All product reviews, Store reviews for reviews about your shop, or This product on product pages.

Settings

SettingWhat it does
Review scopeThis product, All product reviews, Store reviews (about the shop itself) or All reviews. This product shows all reviews outside product pages.
Show from (reviews), Show up to (reviews)Hide the bar outside this range. On product pages this counts the product's reviews, elsewhere the reviews in this block.
StructureThe text of the bar. Default: {logo} {stars} <b>{rating}</b> based on <b>{count}</b> {review|reviews}. Placeholders: {logo}, {stars}, {star}, {rating}, {rating_decimal}, {max}, {count}, {count_compact}. See text templates for how they work.
Link, Open link in new tabWhere a click goes, for example #product-reviews. Empty shows no link.
LayoutInline sits in the text flow. Centered strip and Full-width strip get a background, centered in the section or across the full screen width.
Background colorEmpty is transparent.
Text color, Text sizeEmpty text color uses your theme's. Text size is relative to your theme's, 100% keeps it.
Star color, Star sizeEmpty star color uses the one from 5zero Core. Star size is relative to Core's, where the star icons are set too.
Logo, Logo max widthThe image for {logo}, like a review platform logo.
Anchor IDAn ID links can jump to.
Custom CSSApplies to this block only. See Customising blocks.

Data

The block reads these metafields. Your theme code can read the same ones; their full structure is in the reference. Which ones depends on the Review scope: product reads the product's rating, mixed the shop's rating, and store the shop's store_reviews_rating.

  1. rating and rating_count: on a product the product's own, on the shop those of all reviews.
  2. rating_count_compact: the count shortened for tight spaces, like 2.3k.
  3. store_reviews_rating and its count, on the shop: store reviews only, about the shop rather than a product.
  4. product_reviews_rating and its count, on the shop: product reviews only.

Examples

The block reads rating and rating_count from the product or the shop, depending on the scope; store scope reads store_reviews_rating. To restyle the block itself, its colors are also CSS custom properties: --fo-rating-bar-bg and --fo-rating-bar-color in its Custom CSS override the color settings.

The examples below build the rating into your own theme code. Each example brings the CSS for exactly the look of its preview, scoped to its own classes so it does not touch the rest of your theme. Only the font and the text color come from your theme. The stars (fo-stars) need 5zero's star styles on the page, which every 5zero block and the Card Rating app embed load.

Rating in the announcement bar

The shop's own metafields hold the rating across all reviews. rating_count_compact gives a short number for tight spaces, like 2.3k:

Rated 4.8 from 2.3k+ reviews
{%- assign fiveoh = shop.metafields['app--324569563137'] -%}
{%- if fiveoh.rating_count.value > 0 -%}
  <a href="/pages/reviews" class="reviews-announcement">
    <span class="fo-stars" style="--fo-rating: {{ fiveoh.rating.value.rating }}"></span>
    Rated {{ fiveoh.rating.value.rating }} from {{ fiveoh.rating_count_compact.value }}+ reviews
  </a>
{%- endif -%}

The texts are in English to keep the code short. Other languages

Product reviews only

The shop's rating counts every review. To count only product reviews, read product_reviews_rating and product_reviews_rating_count; for reviews about your shop, store_reviews_rating and store_reviews_rating_count:

4.7 based on 1984 product reviews

{%- assign fiveoh = shop.metafields['app--324569563137'] -%}
<p class="reviews-rating-line">
  <span class="fo-stars" style="--fo-rating: {{ fiveoh.product_reviews_rating.value.rating }}"></span>
  <span>
    <strong>{{ fiveoh.product_reviews_rating.value.rating }}</strong> based on
    <strong>{{ fiveoh.product_reviews_rating_count.value }}</strong> product reviews
  </span>
</p>

The texts are in English to keep the code short. Other languages

Troubleshooting

  1. No rating shows: check that there are reviews for the chosen Review scope. Store reviews only counts reviews about your shop.
  2. The background does not reach the edges: set Layout to Full-width strip.