Getting Smartrr live on a Shopify 2.0 theme takes three steps: set up a subscription program in Smartrr, add the subscription widget to your product page, and give customers a way into the account portal. This article points you to the right guide for each step and keeps a developer reference at the end.
Before you start: check Shopify's subscription requirements. They list the supported payment gateways and other limits on selling subscriptions.
1. Set up a subscription program
In Smartrr, go to Setup under Resources. On the Subscription setup tab, create a program (or click Use a demo program for a "Subscribe & Save 10%" program), then add products to it. See Subscription Programs for details.
Tip: Give every subscription product at least one variant, even if it has only one option. If you add variants later, subscriptions running on Shopify's "Default variant" will fail and need to be re-mapped.
Using the demo product? Set its sales channel to Online Store in Shopify, or it won't appear in previews or on your store.
2. Add the subscription widget to your product page
On the On-site setup tab, install the Smartrr snippets on a duplicate of your theme. Leave I'm planning on using Smartrr's subscription widget checked to use the app block. Uncheck it if a developer will build the widget with the snippet instead.
Then choose how to add the widget:
App block (no code): Smartrr Subscription Widgets
Not sure which to use, or want a custom design: Adding the Smartrr subscription widget to your product page
Themes compatible with the app block: Colorblock, Craft, Crave, Creator, Dawn, Enterprise, Expanse, Fetch, Focal, Impact, Impulse, Motion, Origin, Prestige, Publisher, Refresh, Ride, Sense, Spotlight, Streamline, Studio, Taste, and Warehouse.
If your theme supports it, the onboarding setup shows a green banner confirming it, and will guide you through the next steps. Theme not supported? Use the guided install instead.
3. Connect the customer account portal
The portal is where subscribers manage their subscriptions. On Shopify's new customer accounts, you link to it from the account menu, with no theme code needed. Follow The Smartrr Customer Account Portal: Overview and Setup.
Optional: get more from Smartrr
Developer reference
CSS selectors for the subscription widget
Add custom CSS in the app block's Custom CSS field, or in your theme's stylesheet if you use the snippet.
/* Universal Selectors */
.smartrr-plans-frequency-label /* Frequency Text */
[data-smartrr-price-style] /* Pricing Display */
[data-smartrr-subscribe-price] /* Subscription/OTP Price */
[data-smartrr-regular-price] /* Strikethrough Price */
/* Sub Program Radio Selectors */
[data-smartrr-selling-plan-group-input] + .smartrr-selling-plan-group-input-display:before /* Border color */
[data-smartrr-selling-plan-group-input] + .smartrr-selling-plan-group-input-display:after /* Inner Radio Color */
.smartrr-selling-plan-group-name /* Selling Plan Group Name Text */
/* Sub Program Dropdown */
[data-smartrr-selling-plan-group-select-id] /* Sets border/radius, width, padding, text and background color of the select element */
/* Sub Program Pills */
[data-smartrr-selling-plan-group-id].smartrr-group-active [data-smartrr-selling-plan-group-input-display-pills] /* Sets background and text color of active pill element */
[data-smartrr-selling-plan-group-id] [data-smartrr-selling-plan-group-input-display-pills] /* Sets background and text color of inactive pill element */
.smartrr-pills-header /* Used for font size, This affects group and plan pills */
[data-smartrr-selling-plan-group-input-display-pills] /* Sets border/border-radius */
/* Sub Program Grids */
.smartrr-grid-container /* Sets grid template for plan and group grids */
[data-smartrr-selling-plan-group-id].smartrr-group-active [data-smartrr-selling-plan-group-input-display-grid] /* Sets background and text color of active grid element */
[data-smartrr-selling-plan-groups-grid] [data-smartrr-selling-plan-group-input-display-grid] /* Sets background and text color of inactive grid element. Also sets font size */
[data-smartrr-selling-plan-group-input-display-grid] /* Sets border/border-radius of grid elements */
/* Plan Dropdown */
[data-smartrr-selling-plans-select] /* Selling plans dropdown */
/* Plan Radio */
[data-smartrr-selling-plan-radio] + .smartrr-selling-plan-input-display:before /* Border Color */
[data-smartrr-selling-plan-radio]:checked + .smartrr-selling-plan-input-display:after /* Inner Radio Color */
.smartrr-selling-plan-radio-header /* Selling Plan Name */
/* Plan Pills */
[data-smartrr-selling-plan-pills-header].smartrr-plan-active /* Active Pill Element, Used for background color and text color */
[data-smartrr-selling-plans-select].smartrr-pills-header /* Used for inactive elements background and text color. Also used for border settings/border-radius for plan pills */
.smartrr-pills-header /* Used for font size, This affects group and plan pills */
/* Plan Grids */
.smartrr-grid-container /* Sets the grid templates, also sets the width of grid container */
.smartrr-plan-active.smartrr-input-display-grid /* Active grid element’s background and text color */
[data-smartrr-selling-plans-select].smartrr-input-display-grid /* Inactive element’s background and text color. Also used for border settings/radius for all plan grid elements */
Show subscription pricing outside the widget
Add this where you want the price to appear, such as near the product title:
<div data-smartrr-product-id="{{ product.id }}" data-smartrr-price-style="overwrite-compare" data-use-quantity="true">
<span data-smartrr-compare-price></span>
<span data-smartrr-regular-price></span>
<span data-smartrr-subscribe-price></span>
</div>
Change what it shows with the data-smartrr-price-style value:
Value | Shows |
| The one-time purchase price |
| The one-time purchase price and the compare-at price |
| The selected subscription plan's price |
| The selected plan's price and the compare-at price |
| The discounted price, struck through |
| The compare-at price, struck through |
Sync your theme's variant selector with the widget
Use this if switching variants on your product page doesn't update the widget's plans and prices.
Open your product template, usually
main-product.liquidorproduct.liquid. If you can't find it, usetheme.liquid.Paste this at the bottom of the file:
<script>
document.addEventListener("DOMContentLoaded", function() {
const SmartrrHandler = window.smartrrProductList["{{ product.id }}"];
const variantSelectors = document.querySelectorAll('[data-variant-option-value]');
variantSelectors.forEach(selector => {
selector.addEventListener('change', () => {
// If the variant selectors' values are the variant names
const variantName = SmartrrHandler.ui.apiGetValue(selector);
const variant = SmartrrHandler.ui.logic.apiGetVariantByName(variantName);
SmartrrHandler.ui.logic.apiChangeVariant(variant.id);
/* If the variant selectors' values are the variant ids
SmartrrHandler.ui.logic.apiChangeVariant(selector.value);
*/
})
})
});
</script>In the
querySelectorAll(...)line, replace[data-variant-option-value]with a selector that matches only your theme's variant inputs. Find one by inspecting the variant selector in your browser's developer tools:
// Class syntax
document.querySelectorAll('.variant-selector')
// Data-attribute syntax
document.querySelectorAll('[data-variant-selector]')
ℹ️ Tip: If your variant selectors aren't <input> elements, change the 'change' event listener to 'click'.
Troubleshooting
Smartrr doesn't appear when I preview my store. Check that your subscription program is saved. Go to Subscription Programs › Manage Program; if a Discard / Save banner shows at the top, click Save.
Still stuck? Contact us by chat in the Smartrr app or at support@smartrr.com. We also partner with agencies and offer white-glove onboarding on our Grow and Excel plans.