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!
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025