For Shopify stores

Shopify Brewing Calculators

Add Captain Brew's brewing calculators to your Shopify store with a Custom Liquid section. No app to install and no theme code to edit. Your customers work out IBU, priming sugar or yeast pitch rates on your product pages, not on someone else's site.

The widgets need a Captain Brew shop plan: 1 month free, then $25/month. No setup fee, no commitment.

1. Before you start

You need three things:

  • A Captain Brew shop account. Register with your shop name and the domain your customers use, for example yourshop.com. If you have not connected a custom domain, use your yourshop.myshopify.com address. Your first month is free.
  • The embed code. In the Business Portal, open Widgets, pick a calculator and copy the snippet. Your client token is already in it.
  • A theme with a Custom Liquid section. Dawn and Shopify's other free themes have one. Most paid themes do too.

This is what a snippet looks like. The one you copy from the portal has your own token instead of YOUR_CLIENT_TOKEN.

<iframe id="ibu_calculator"
    src="https://www.captainbrew.com/iframes/ibucalculator.php?client=YOUR_CLIENT_TOKEN"></iframe>

<style>
    #ibu_calculator{
        width:100%;
        height:1280px;
        border:0px;
    }
    @media only screen and (max-width : 991px) {
        #ibu_calculator{height:1400px;}
    }
    @media only screen and (max-width : 767px) {
        #ibu_calculator{height:3600px;}
    }
</style>

The <iframe> loads the calculator. The <style> block sets its height, with a taller height on narrow screens where the calculator's fields stack. Paste both parts together.

2. Add a calculator with a Custom Liquid section

This puts a calculator on any page that uses a template, such as your home page.

  1. From your Shopify admin, go to Online Store.
  2. Find the theme you want to edit, then click Edit theme.
  3. Use the Home page drop-down at the top of the editor to pick the template you want, or stay on the home page.
  4. In the sidebar, click Add section, type Custom Liquid in the search box and select Custom Liquid.
  5. Paste your snippet into the Liquid code field.
  6. Drag the section to where you want it on the page, then click Save.

The preview in the theme editor may show Forbidden instead of the calculator. The widget only loads on the domain registered to your Captain Brew account, and the editor preview can run on a different address. Open the page on your live store to check it.

The Custom Liquid section is in the Template area. If you add it to the header or footer instead, it shows on every page of your store, which is rarely what you want for a calculator.

3. Make a "Brewing calculators" page

Shopify pages use the default page template, which only shows the page's text. To put calculators on a page, make a page template for them first, then assign it to a new page.

Create the page template

  1. Go to Online Store and click Edit theme.
  2. Click the Home page drop-down, choose Pages, then click Create template.
  3. Name it calculators, choose Default page in Based on, and click Create template.
  4. Click Add section > Custom Liquid and paste the first calculator. Add one Custom Liquid section per calculator, so you can reorder them.
  5. Click Save.

Create the page and assign the template

  1. Go to Online Store > Pages and click Add page.
  2. Enter a title such as Brewing calculators. Add a short introduction in Content if you like; it shows above the calculators.
  3. In the Theme template drop-down, select calculators.
  4. Click Save.

Add it to your menu

  1. Go to Content > Menus and open your main menu.
  2. Click Add menu item, name it, and pick the Brewing calculators page as the link.
  3. Click Save.

A Shopify template can have up to 25 sections. Each calculator has its own iframe ID, so several different calculators can share a page. Don't add the same calculator twice on one page.

4. Put a calculator on product pages

Calculators sell best next to the product they are about: the IBU calculator on hops, the priming sugar calculator on bottling sugar, the pitch rate calculator on yeast. Use a separate product template so the calculator only shows on the products that need it.

Example: the IBU calculator on hop products

  1. Go to Online Store and click Edit theme.
  2. Click the Home page drop-down, choose Products, then click Create template. Name it hops and base it on Default product.
  3. In the sidebar, find the Product information section, click Add block and select Custom Liquid. Paste the IBU calculator snippet. If your theme has no Custom Liquid block, click Add section > Custom Liquid to add it under the product instead.
  4. Drag the block to where you want it, for example below the description, and click Save.
  5. Go to Products, open a hop product, choose hops in the Theme template drop-down and click Save.

To switch many products at once, select them in Products, click Bulk edit, add the Template column from the Columns menu and set it to hops.

A Custom Liquid block inside Product information sits in the product column, which is narrow on desktop. Larger calculators such as the IBU calculator and water chemistry are easier to use in a full-width Custom Liquid section below the product.

5. Height, mobile and Dawn-style themes

Height and mobile

An iframe does not grow with its content, so the snippet sets a fixed height and a taller height for each smaller screen width. These are the starting heights for some common calculators:

Widgetiframe IDDesktopPhone
IBU Calculator ibu_calculator 1280px 3600px
ABV Calculator abv_calculator 340px 550px
Priming Sugar Calculator priming_calculator 840px 1350px
Keg Carbonation Calculator keg_calculator 340px 600px
Pitching Rate Calculator yeast_calculator 1350px 4500px
Water Chemistry Calculator waterchemistry_calculator 3700px 8240px
Complete Recipe Builder recipe_calculator 1400px 2000px

If the bottom of a calculator is cut off, or there is a scroll bar inside it, raise the height in the matching @media rule of your snippet. If there is a large empty gap below it, lower the height. Check on a phone after saving: your theme's padding changes how much room the calculator gets.

Dawn and other Shopify themes

  • The Custom Liquid section has its own color scheme and top and bottom padding settings. Use the padding to space the calculator away from the sections around it.
  • In Dawn, the Custom Liquid section runs the full width of the screen. To line the calculator up with the rest of your page content, wrap the snippet in Dawn's page-width container:
<div class="page-width">
<iframe id="ibu_calculator"
    src="https://www.captainbrew.com/iframes/ibucalculator.php?client=YOUR_CLIENT_TOKEN"></iframe>

<style>
    #ibu_calculator{
        width:100%;
        height:1280px;
        border:0px;
    }
    @media only screen and (max-width : 991px) {
        #ibu_calculator{height:1400px;}
    }
    @media only screen and (max-width : 767px) {
        #ibu_calculator{height:3600px;}
    }
</style>
</div>

Other themes use different class names for this container. If yours doesn't line up, check its documentation or leave the wrapper out.

Widgets are styled to your brand colours from your Business Portal settings, so they don't pick up your theme's colours automatically.

6. The recipe builder and add-to-cart

The recipe builder goes on a page the same way: make a page template, add a Custom Liquid section and paste the recipe builder snippet. It shows the malts, hops and yeasts from the catalog you uploaded to the Business Portal.

With add-to-cart turned on, the builder sends the recipe's ingredient list to your page as a browser message when the customer clicks Add to Cart. The Business Portal has a listener script and the exact data format. You can paste the script into the same Custom Liquid section, below the iframe. Your developer then matches each item to a Shopify product variant and adds it with Shopify's cart (for example the Ajax Cart API). The calculators and charts need none of this.

Questions from Shopify store owners

Do I need a Shopify app to add brewing calculators?

No. Each Captain Brew widget is an iframe. You paste it into a Custom Liquid section or block in the Shopify theme editor. There is nothing to install from the Shopify App Store and no theme code to edit.

Are the calculators free?

No. The widgets are part of the Captain Brew Homebrew Shop Widgets plan. The first month is free, then it is $25 per month for every widget, with no setup fee. The widgets only load on the shop domain registered to your account.

Does it work with my Shopify theme?

It works with any theme that has a Custom Liquid section, which includes Dawn and Shopify's other free themes. If your theme has no Custom Liquid option, you can paste the code into a page's HTML view instead, or ask your theme developer.

Can I put a calculator on product pages?

Yes. Create a product template, add a Custom Liquid block or section with the calculator, and assign that template to the products you want, for example the IBU calculator on hop products.

Do the calculators work on mobile?

Yes. The embed code sets a different iframe height for phones, tablets and desktops, so the calculator is not cut off on small screens.

Why does the calculator say Forbidden?

The widget only loads on the domain you registered in the Business Portal. Check that the page is on that domain. The theme editor preview may run on a different address, so check the live page too. If it still fails, email [email protected].

Put brewing calculators on your Shopify store Register your shop, copy the code and paste it into a Custom Liquid section. Your first month is free, then $25/month.
Start your free month

Stuck on a step? Email [email protected].