Selling Plan Picker Snippet
Show subscription options in sections where your app’s block doesn’t appear, like the homepage featured product. Or find out why the widget is missing.
What you’ll need
A subscription app with a selling plan (Shopify Subscriptions or another)
A duplicate of your theme to test on
How to get this: A duplicate of your theme to test on
- Online Store › Themes › … on your theme › Duplicate.
- Make the change on the copy, preview it, and publish only when it works.
The theme code editor (to paste a snippet)
How to get this: The theme code editor
- On the copy of your theme: … › Edit code.
- Hover the snippets folder, click New File…, name it as the tool says, paste and Save.
1Choose how it looks
Subscription-only products always start on a plan.
Used by the One-time / Subscribe layout.
Leave empty to hide. {percent} is the saving vs. the one-time price.
2Add it to your theme copy
- In the duplicate theme, click … > Edit code. Under Snippets, click Add a new snippet and name it
est-selling-plan-picker. - Paste the snippet below into it and save.
- Open the section file (for example
sections/featured-product.liquid), find the product form ({%- form 'product'), and paste the render line inside it, above the add-to-cart button. - Remove the subscription app’s block from that section if it has one, so only one picker sends a plan.
3Test it, and how to remove it
- Preview the theme copy and open the page with the section.
- Pick a plan, add to cart, and check the cart shows the plan name. Switch variants and check the options follow.
- If the cart line has no plan name, your theme probably has its own purchase options that send their own
selling_plan(some themes’ add-to-cart scripts always add it, even from a different block). Remove or hide that picker, or use it instead of this snippet. The snippet logs a warning in the browser console when it sees anotherselling_planfield on the page. - Go to checkout and confirm the subscription line and price. Then publish the copy.
Remove it
- Open Online Store > Themes > … > Edit code on the theme where you added it.
- Find every render line: search the theme for est-selling-plan-picker (Ctrl+Shift+F or the search box above the file list).
- Delete each {% render 'est-selling-plan-picker' … %} line and save.
- Delete the file snippets/est-selling-plan-picker.liquid.
- Nothing else was changed, so the theme is back to how it was.
1Check the product data
Open your product on the online store, add .js to the end of the address (yourstore.com/products/coffee.js), copy the whole page and paste it here.
No store handy?
2Then check the theme
- The block isn’t added to this section. Subscription apps add a block to the product page template only. In the theme editor, open the page or section, click Add block, and look under Apps. Featured product and many custom sections don’t offer app blocks at all; use the snippet above there.
- The app embed is turned off. Some apps also need an app embed. In the theme editor, open App embeds (the puzzle-piece icon) and turn the subscription app on.
- The section has no product form. Plans are sent with a form that posts to /cart/add and has an input named id (the variant). Sections that use a plain “Add to cart” link or button with their own script have nowhere to put the selling_plan.
- Quick add and cart drawers skip it. Quick-add buttons on collection pages usually add the default purchase option without rendering any blocks. Subscription-only products fail there with “Variant can only be purchased with a selling plan”. Hide quick add for them, or link to the product page.
- A custom add-to-cart script drops the plan. If your theme or an app builds its own /cart/add.js request, it must include selling_plan from the form. Check the request in your browser’s developer tools (Network tab): the payload should include selling_plan.
- Two pickers in one form. If both the app block and a snippet are in the same form, two selling_plan values are sent and the result is unpredictable. Keep one.
- The theme has its own purchase options. Some themes ship their own subscription picker and an add-to-cart script that always appends its selling_plan, even from outside the product form. That silently replaces the plan picked in another picker, so the cart line has no plan. Use only one picker, and check the cart line shows the plan name.
- The theme was customized or is old. Themes built before Online Store 2.0 don’t support app blocks. Check with the theme developer, or use the snippet.
How it works
- Pick a layout and labels.
- Create one snippet file in a duplicate theme and paste the code.
- Add one render line inside the section’s product form.
- The picker lists the selected variant’s plans and keeps a hidden selling_plan field in sync, so add to cart sends the plan.
- Test add to cart and checkout, then publish. Delete the line and file to remove it.
Guides
Questions
When do I need this?
When a subscription app’s block doesn’t show: the homepage featured product, landing pages, or custom sections. If the app block works where you need it, use the app block.
Will it break my theme?
It’s one new snippet file plus one line where you want it. Everything is namespaced est-sp, nothing else is edited, and removing the line and the file undoes it. Try it on a duplicate theme first.
Does it work with Shopify Subscriptions, Recharge, Appstle, Loop and Seal?
It reads Shopify’s own selling plan data, so it works with any app that uses Shopify selling plans. It doesn’t replace the app’s customer portal or emails.
Why doesn’t the price at the top change when I pick a plan?
The snippet shows each plan’s price next to it but doesn’t rewrite your theme’s price element, because every theme does that differently.
Based on Shopify’s “Add subscriptions to your theme” tutorial and the selling_plan_allocation object.