Inspiration

Here are some common ways that the Storefront Javascript API can be used to build custom on-site features.

Create a Reviews Page With a Product/Group Review Switcher

This recipe will guide you through setting up a dedicated page which can switch between showing reviews for different products or groups.

1. Navigate to the store's theme: Sales Channels -> Online Store -> Themes and press the menu item with the three vertical dots. Press "Edit Code" from the menu which appears:

2. Create a new file in the page folder of your theme called page.okendo-reviews-switcher (This will be the template name for your dedicated reviews page template).

3. Copy/paste the markup below:

4. Modify the product/group IDs in the markup. For each group or product you wish to filter the reviews down by you will create a new orc-collectionControls-item. The value of the radio button will be either the Group ID (a group ID is in the form of a GUID) or the Product ID (a product ID is in the format shopify-<YOUR PRODUCT ID>:

5. Save the page template and exit the theme code editor.

6. Navigate to Online Store -> Pages and assign the page template to a given page in the Shopify: Admin:

7. View the page and confirm the switching is correct:

Last updated