Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hello, I am updating a store from the recharge checkout to recharge shopify checkout integration. I have been told that when the conversion takes place the current AJAX parameters will need to be updated along with widget customizations. I have reviewed this guide but am a little out of my depth.
It shows this code will need to be used, my question is where do I place this code in my theme files? I don't see the AJAX code I will need to replace:
STORE URL: hairtieclub.com
New AJAX Code:
<input type="button" id="add-to-cart-button" value="ADD TO CART" onClick="addItemToCart(36807328039071, 1, {{product.selling_plan_groups[0].selling_plans[0].id}})">
<script>
function addItemToCart(variant_id, qty, selling_plan) {
data = {
"id": variant_id,
"quantity": qty,
"selling_plan": selling_plan
}
jQuery.ajax({
type: 'POST',
url: '/cart/add.js',
data: data,
dataType: 'json',
success: function() {
window.location.href = '/cart';
}
});
}
</script>
Current Page:
The theme files I see that seem to be like they could be relevant are:
snippets/ajax-cart-template.liquid
assets/ajax-cart.js.liquid
templates/page.sign-up.liquid
snippets/subscription-product.liquid
I cannot seem to figure out where I will be putting this new code, or how it will interact with the rest of the theme files and help would be appreciated, thanks guys!
Discover how to increase customer engagement on your store with articles from Shopify A...
By Jacqui Apr 23, 2025Hey Community 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025