Redirect to Checkout from AJAX Cart

Note: This is an advanced customization guide that requires knowledge of the Shopify liquid, javascript, and HTML

In your Shopify store's theme editor, you'll want to search for the file "subscription-theme-footer"

This will turn up the following result:

Clicking on the file will open it up into your code editor. You'll want to scroll down to approximately line 65, or search for "reChargeSaveCartNoteAndRedirectToCart();"

You'll find and delete the following two lines of code (highlighted for your convenience):

And replace them with this entire block of code:

var paramCart = '&cart_token=' + (document.cookie.match('(^|; )cart=([^;]*)')||0)[2];
$.ajax({
	type: 'GET',
	url: '/cart.js',
	dataType: 'text',
	success: function(data) {
		if (data.indexOf("subscription_id") > -1) {
			var paramDomain = 'myshopify_domain={{ shop.permanent_domain }}';
			try {
				var paramLinker = "&" + ga.getAll()[0].get('linkerParam');
			} catch (err) {
				var paramLinker = '';
			}
			var paramCustomer = '{% if customer %}&customer_id={{ customer.id }}&customer_email={{ customer.email }}{% endif %}';
			window.location = "https://checkout.rechargeapps.com/r/checkout?" + paramDomain +  paramCart + paramLinker + paramCustomer;
		} else {
			window.location = '/checkout';
		}
	}
});

The end result will look like the following (new code is highlighted for your convenience):

Still stuck? How can we help? Still stuck? How can we help?