Skip to main content

Review Form

Let shoppers write a review on the product page, inline or in a popup, with photos and videos.

The 5zero Review Form lets shoppers write a review right on the product page: a star rating, a title, the review text, photos and videos, and the name shown with the review. It sits on the page as a form, or behind a "Write a review" button that opens it in a dialog.

Customers who are logged in get their first name filled in; clearing it posts the review anonymously. Customers who already reviewed the product see the date of their review instead of the form.

The form needs the 5zero Core app embed to submit.

Where to place it

  1. Product page, in the main content

Adding it to your theme

  1. In the Theme Editor, open a product template.
  2. Click Add block below the Review List and choose 5zero Review Form from the Apps tab.
  3. Choose the Display: Inline shows the form on the page, Popup shows a "Write a review" button that opens it. In a popup, any button in your theme can open it too.
  4. Choose Who can review.

Settings

SettingWhat it does
DisplayInline shows the form on the page. Popup opens it over the page, from its own button or the review list's Write a review button.
Max width, AlignmentThe form's width, in any CSS unit, and where it sits in its section.
Open button text, Open button classesThe Popup button and your theme's classes for it. Empty text hides the button, so only the review list's button opens the form.
Who can reviewEveryone, Logged-in customers or Logged-in buyers of the product. Everyone else sees why, with a login link if logging in helps.
Field labelsInside the fields as placeholders, or Above the fields.
Title label, Review label, Upload label, Author labelThe fields. An empty label hides its field.
Field classesYour theme's field classes, like field__input. Every field uses them.
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.
Submit button text, Submit button classesThe button that sends the review.
Thank-you textShown after the review was sent. Empty shows nothing.
Heading, Heading tag, Heading classesThe text, its HTML level for the page outline, and your theme's classes for its look, like h2. Empty text shows no heading.
Anchor IDreview-form by default. The review list's Write a review button opens the form by it.
Custom CSSApplies to this block only. See Customising blocks.

Whether new reviews are published at once or wait for your approval is set in the app, see Managing reviews.

Data

The form reads one metafield, on the logged-in customer: review_handles. It lists every product and variant the customer reviewed, so the form can show "You reviewed this product on …" instead of asking again.

Examples

To restyle the block itself, see Customising blocks. The examples below build a form in 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 review form of your own

<fo-review-form> submits any form marked with data-fo-form, as long as its fields keep their names: rating, title, body, author and media. Layout and markup are free. data-fo-show shows the success and error messages in the right state. Customers who already reviewed the product see a note instead, read from their review_handles. This needs the 5zero Core app embed.

{%- assign handles = customer.metafields['app--324569563137'].review_handles.value -%}
{%- assign product_gid = 'gid://shopify/Product/' | append: product.id -%}
{%- assign variant_gid = 'gid://shopify/ProductVariant/' | append: product.selected_or_first_available_variant.id -%}

<fo-review-form data-fo-product-id="{{ product.id }}" data-fo-variant-id="{{ product.selected_or_first_available_variant.id }}" data-fo-text-error="Your review could not be sent.">
  {%- if handles[variant_gid] or handles[product_gid] -%}
    <p>You have already reviewed this product.</p>
  {%- else -%}
    <form data-fo-form>
      {%- for i in (1..5) -%}
        <label><input type="radio" name="rating" value="{{ i }}" required> {{ i }}</label>
      {%- endfor -%}
      <input name="title">
      <textarea name="body" required></textarea>
      <input name="author" value="{{ customer.first_name }}">
      <input type="file" name="media" accept="image/*,video/*" multiple>
      <button type="submit">Submit review</button>
    </form>
    <p data-fo-show="success" hidden>Thank you!</p>
    <p data-fo-show="error" hidden data-fo-field="error_message"></p>
  {%- endif -%}
</fo-review-form>

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

The full list of form attributes and states is in HTML & JS.

A "Write a review" button

With the block in Popup mode, any element in your theme can open it, for example a button next to the product rating. aria-controls must match the block's Anchor ID:

<button type="button" class="reviews-write-button" data-fo-action="open-modal" aria-controls="review-form">
  Write a review
</button>

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

Troubleshooting

  1. Submitting does nothing: turn on the 5zero Core app embed.
  2. A review was sent but does not appear: it may be waiting for approval in the app.
  3. The form does not show: check Who can review. With Logged-in customers or Logged-in buyers of the product, visitors must be logged in, and buyers must have bought the product.