Skip to main content

Smartrr guided install on a custom Shopify theme

Implementing Smartrr on storefronts with modified Shopify themes or custom liquid themes

Before you start

Smartrr's custom setup requires five files to be added to your theme code. The onboarding wizard adds any that are missing for you. If a file doesn't import, download it below and add it yourself, or contact us and we'll add it for you.

Using Dawn or another free Shopify theme you haven't edited? Or prefer to use the Smartrr app block? You don't need this article. Use the one-click install instead: Installing Smartrr on a Shopify 2.0 theme (Automatic Install).

Check your eligibility first. Before offering subscriptions, review Shopify's subscription requirements. They list the supported payment gateways and other limits on selling subscriptions.

The Smartrr files

File

Folder in your theme

What it provides

Download

smartrr-product.liquid

Snippets

The subscription options on your product page

smartrr-product-styles.liquid

Snippets

The default look of the subscription options

smartrr-product-script.js

Assets

Updates plans and prices as customers switch variants and options

smartrr-account.liquid

Snippets

The Smartrr account portal on classic customer accounts

smartrr-account-theme.liquid

Snippets

Your portal design from the Theming page in Smartrr

smartrr_customer_portal_token.liquid

Snippets

Unique token for the customer portal

Note: The sixth file, smartrr_customer_portal_token.liquid, holds a security token unique to your store. Smartrr creates it for you, so there's nothing to download. If it's missing from your theme, contact us.

Adding a missing file yourself

Step 1: Duplicate your theme

Work on a copy so changes don't appear on your live store before you're ready.

  1. In Shopify, go to Online Store › Themes.

  2. On your current theme, click ⋯ › Duplicate.

  3. Rename the copy so it's easy to find, for example [Your store] Smartrr install [date].

image highlighting how to duplicate a Shopify theme.

Step 2: Add the file

  1. On your duplicated theme, click ⋯ › Edit code.

  2. Add the file in the folder shown in the table above:

    • Snippets: right click on the "snippets" folder, select "Upload", choose the file you're uploading and let Shopify do the rest.

    • Assets: follow the same steps as above but for the "Assets" folder.

Confirm each file's name is exactly as shown in the table. Smartrr looks for these names, so a file with a different name won't load.

Uploading the files to your Shopify theme.

Rendering the Smartrr product widget

Step 1: Render smartrr-product in the product template

  1. Find your product template (this is usually called main-product.liquid or product.liquid).

  2. Once you’ve opened the file, search for the product form {%- form 'product'}, paste {% render 'smartrr-product' %} inside the form. We typically recommend placing the snippet between the variant selector and the quantity selector, but you can place in any order you see fit.

  3. When added, the product form should look something like this:

    Render the Smartrr widget within the product form using the line {% render 'smartrr-product' %}.
  4. Save the file. You should be able to preview Smartrr on your site upon successfully modifying this product form. Having trouble? Skip to Troubleshooting steps.

ℹ️Tip: If your product template doesn't have the product form {%- form 'product'}, it's possibly stored in the buy-buttons.liquid or similar file that builds the add to cart button on the product page.

Also, the snippet's base CSS depends on the product form including the data-smartrr-form-id attribute as seen in the below screenshot:

Adding Smartrr snippet to snippets/buy-buttons.liquid.

Rendering the Smartrr customer portal

Step 1: Render smartrr-account in the account template (Shopify legacy customer account only) or on its own page template

  1. In your duplicated theme’s code base, find the liquid file for your store’s account page. This is usually called main-account.liquid or customers/account.liquid. This file is typically located under either the Templates heading.

    1. If you're using Shopify's new customer account portal, you have 2 options here:

      1. Link the Smartrr app proxy URL to a menu (preferably a new customer account portal menu). Not sure how to create menus in your theme? Refer to Shopify's Add, remove, or edit menu items in your online store.

        1. Not sure where to get the app proxy? For new installations, the URL is /a/subscriptions. So, the URL to link to your newly created menu to the Smartrr customer portal would be /a/subscriptions/customer-portal.

      2. Render Smartrr on a page template >> assign the template to its own page >> link the page to a menu. This approach has more steps, and is only recommended if you intend on making developer-customizations to the portal's page.

  2. At the very beginning of the file, paste the following snippet:

    <!-- BEGIN SMARTRR SNIPPET -->
    {% render 'smartrr-account' %}
    <!-- END SMARTRR SNIPPET -->

    {{ 'customer.css' | asset_url | stylesheet_tag }}
  3. Check the page that you've rendered smartrr-account on to confirm that the customer portal is displaying.

ℹ️Tips:

  1. Customers must log into the store's account to view the Smartrr portal.

  2. Subscriptions are tied to the email address/account that was used at checkout.

  3. There are 2 proxy URLs:

    1. The new proxy URL is /a/subscriptions.

    2. The old proxy URL that is in effect for legacy customers is /a/customers.

  4. You can easily find your proxy by using the View portal as customer feature. The button will redirect you to the proxy URL followed by the id and signature information needed for the session.

    1. You can edit the app proxy under Shopify's Settings >> Apps >> Smartrr >> App Proxy URL

      Smartrr's app proxy URL found under Shopify's apps' settings.

Troubleshooting

I see a "Could not find asset" error on my store

A Smartrr file is missing or its name doesn't match. Compare the file name in the error with the table above, check it's in the right folder, and download it again if needed.

Why don't I see the Smartrr product widget on my theme once I preview?

Whether you've created a demo Subscription Program or made a new program from scratch, you may need to double check and make sure your program details have been successfully "saved". To do this, go to Subscription Programs > Manage Program. Check and see if there is a Discard / Save banner at the top, and click the green Save button.

If the Smartrr widget doesn't render, be sure to confirm your subscription program is created, includes products and is saved.

Still stuck?

Contact us by chat in the Smartrr app or at support@smartrr.com, and we'll add any missing files for you. We also offer full white-glove onboarding support with our Grow and Excel plans.

What's next

Did this answer your question?