How to add a ReCharge subscription to the cart using the Buy SDK (JavaScript)

Solved
thomasboulongne
New Member
2 0 2

I'm building a custom storefront, using the Shopify Buy SDK in JavaScript. I'm able to add regular product to the cart, but I can't figure out how to add ReCharge subscriptions. I have all the data that should be needed, the ruleset_id, the variant id, the frequency, the frequency unit, but can't see how to add the subscription properties to the addLineItems.

Any insight would be appreciated!

vix
Shopify Staff
Shopify Staff
534 105 105

This is an accepted solution.

Hi @thomasboulongne 

 

I would suggest speaking with ReCharge about this for specific details. The basics of the implementation usually is that the option to choose a subscription would be chosen at the cart page or the product page. When I say “cart” here, it would be your created cart using the checkout object. The way i’ve seen it is you will have a button that redirects to a blank page on Shopify. That page automatically adds items to the cart via ajax (the blank page would be an online store generated page and could be served in an iframe). First Add an Item to Cart with AJAX, and from there redirect to the Recharge checkout. 

 

 

Vix | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

0 Likes
rileywestbrook1
New Member
1 0 0

Hi! Did you ever find out a solution for this?

0 Likes
lele
New Member
1 0 0

Were you able to solve this? Do you have any useful link or documentation? 

Thanks!

0 Likes
jeremiah_DO
Tourist
3 0 0

Would desperately like to know how to accomplish this in the context of the new Subscription feature that Shopify is releasing soon.

0 Likes
vix
Shopify Staff
Shopify Staff
534 105 105

Hi @jeremiah_DO 

 

The Storefront API (what the SDK is built on) is not currently compatible with the new Subscription API. It is on our roadmap for 2021 - keep an eye on the changelog! 

 
 
 
 
 

Vix | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

17bc17
New Member
1 0 0

@vix - Is it possible you could provide an alternative solution to this? We are working on a headless build with recharge and their isn't a lot of information available to how you can work with native subscriptions for a headless build currently it seems

0 Likes
dennisregalado
New Member
1 0 0

@17bc17 would love to get a solution to this as well! look's like shopify's native subscription feature forgot about headless builds.

0 Likes