When a Recharge product is added to the cart, we submit line item properties that specifies the product as a subscription and defines the subscription interval. In addition to these properties, you can specify custom line item properties that will be included in the order.
Before you start
- We have recently upgraded the Subscription Widget to V3.0. However, this may not work for your store. If you're having difficulty following this guide, please contact us with details.
Line item property variables
- subscription_id – Last digits of the URL when on the subscription ruleset page.
- Monday = 0, Tuesday = 1, etc.
Pass the properties as a form submit
Below is an incomplete form for adding an item to the cart to demonstrate how the properties must be passed.
<form action="/cart/add" method="post"> <input name="properties[subscription_id]" type="hidden" value="X" /> <input name="properties[shipping_interval_frequency]" type="hidden" value="1" /> <input name="properties[shipping_interval_unit_type]" type="hidden" value="Months" /> </form>
Pass properties via AJAX
For more information on using AJAX to add a product to the cart, visit Adding an item to the cart with AJAX. You can add the additional parameters into the data described in the guide.