In this guide, we'll show you how to create a buy button that will automatically add a subscription product to customer carts on Shopify. To do this, you'll need to have three pieces of information before we begin.
Subscription Buy Button Requirements
Shopify Subdomain
Shopify Product Variant ID
PayWhirl Selling Plan ID
Shopify Subdomain & Base URL
You can find your Shopify subdomain by viewing the URL when you are logged into Shopify. The base of the URL will always be subdomain.myshopify.com/cart/add.
Shopify Product Variant ID
You can find your Shopify product variant ID by viewing the URL when viewing the variant details page. The variant ID you need is listed at the end of the URL after variants/ (in bold below). The URL will be something like...
/admin/products/4426524360000/variants/31517493888888
PayWhirl Selling Plan ID
Finding your selling plan ID can be tricky as it's not included in any app URLs. You'll have to use your browser to inspect the HTML and find the id from the product page on the front end of your website.
Right-click the dropdown with your selling plans on your product page...
Locate the <select> element in the HTML and find the selling plan ID for the option you'd like to add to the cart (blue numbers in the image below)...
โ
Lastly, you'll need to ensure that you have already associated your Shopify variant product with the selling plan from PayWhirl. You can do this from your product pages in Shopify or PayWhirl (link above) when editing your selling plan by clicking the "Products" link at the top of the plan editor.
Subscription Buy Button Format
Once you have all three pieces of information, you can build your link using the format below. Just replace the items in bold with the values you gathered to create the subscription add-to-cart link.
The link format is as follows:
HTTPS://{SUBDOMAIN}.myshopify.com/cart/add?id=XXXXXXXXXXX&selling_plan=XXXXXXXXXXXX
Once the link is created, you can automatically add subscription products to customer carts when customers click it. You can use the link on text, images, buttons, etc. to create subscription buy buttons or create custom add-to-cart options on your Shopify site.
Please let us know if you have any questions. We are happy to help!
Sincerely,
The PayWhirl Team