Skip to main content

Floating Badge

A compact rating badge, inline or pinned to a corner of the screen.

The 5zero Floating Badge is a small card with stars, the rating and the review count, like ★★★★★ 4.8 out of 5 · 2,341 reviews, with an optional logo. Place it inline, or pin it to a corner of the screen, where it stays visible while shoppers scroll.

Where to place it

  1. Fixed to a corner of the screen
  2. Inline in any section

Adding it to your theme

  1. In the Theme Editor, open the template, or the footer if it should appear on every page.
  2. Click Add block and choose 5zero Floating Badge from the Apps tab.
  3. Choose a Position: Inline, or fixed to a corner.

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 badge outside this range. On product pages this counts the product's reviews, elsewhere the reviews in this block.
StructureThe text of the badge. Default: {stars}, <b>{rating}</b> out of 5, {count} {review|reviews} and {logo}, one per line. 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 a page with all your reviews. Empty shows no link.
PositionInline shows it where the block sits. Bottom right, Bottom left, Top right and Top left keep it on screen while scrolling.
Show onAll devices, Desktop only or Mobile only. Mobile means screens narrower than the small screen breakpoint in the app's Display settings.
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.
LogoThe image for {logo}, like a review platform logo.
Anchor IDAn ID links can jump to.
Custom CSSApplies to this block only. See Customising blocks.

Examples

A fixed badge keeps 1rem away from the screen edges. Change the distance with --fo-floating-badge-bleed: 1.5rem; in the block's Custom CSS.

The example below builds the badge 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.

A badge in your theme

The same badge as a link in your own footer or header, from the shop's metafields:

4.8 out of 5 · 2.3k reviews
{%- assign fiveoh = shop.metafields['app--324569563137'] -%}
<a href="/pages/reviews" class="reviews-badge">
  <span class="fo-stars" style="--fo-rating: {{ fiveoh.rating.value.rating }}"></span>
  <span><strong>{{ fiveoh.rating.value.rating }}</strong> out of 5 · {{ fiveoh.rating_count_compact.value }} reviews</span>
</a>

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

Troubleshooting

  1. The badge covers content or the chat button: pick another corner, or move it with --fo-floating-badge-bleed.
  2. No rating shows: check that there are reviews for the chosen Review scope. Store reviews only counts reviews about your shop.