AJAX refresh code for popular Shopify Themes
Overview
To ensure that your cart drawer updates correctly after adding an upsell item, it's essential to implement the appropriate AJAX refresh code specific to your Shopify theme. Below is a list of refresh codes for various popular themes:
Focal
document.querySelector("#upsellplus_drawer_offer").innerHTML = "";
document.documentElement.dispatchEvent(new CustomEvent('cart:refresh', {bubbles: true}));
upsellplusapp.init_drawer_offer();
Impulse
document.querySelector("#upsellplus_drawer_offer").innerHTML = "";
$("form.ajaxcart .js-qty__num").first().trigger("change");
upsellplusapp.init_drawer_offer();
Streamline
document.dispatchEvent(new CustomEvent("cart:build"))
document.querySelector("#upsellplus_drawer_offer").innerHTML = "";
upsellplusapp.init_drawer_offer();
Brooklyn
document.querySelector("#upsellplus_drawer_offer").innerHTML = "";
ajaxCart.load();
upsellplusapp.init_drawer_offer();
Flex
document.querySelector("#upsellplus_drawer_offer").innerHTML = "";
Shopify.theme.jsAjaxCart.updateView();
upsellplusapp.init_drawer_offer();
Flow
document.querySelector("#upsellplus_drawer_offer").innerHTML = "";
document.querySelector('form.cart input.ajaxcart__qty-num').dispatchEvent(new Event("change", { bubbles: true }));
upsellplusapp.init_drawer_offer();
Prestige
document.querySelector("#upsellplus_drawer_offer").innerHTML = "";
document.documentElement.dispatchEvent(new CustomEvent('cart:refresh', {bubbles: true}));
upsellplusapp.init_drawer_offer();
OR
document.querySelector("#upsellplus_drawer_offer").innerHTML = "";
document.documentElement.dispatchEvent(new CustomEvent('cart:refresh', {bubbles: true}));
upsellplusapp.init_drawer_offer();
Debut
closeAjaxCart();
ajaxCartUpdate();
Ella
document.querySelector("#upsellplus_drawer_offer").innerHTML = "";
document.querySelector('div.has-items input.item-quantity').dispatchEvent(new Event("change", { bubbles: true }));
upsellplusapp.init_drawer_offer();
Debutify
document.querySelector("#upsellplus_drawer_offer").innerHTML = "";
theme.ajaxCart.update();
upsellplusapp.init_drawer_offer();
Warehouse
document.querySelector("#upsellplus_drawer_offer").innerHTML = "";
document.documentElement.dispatchEvent(new CustomEvent('cart:refresh', {
bubbles: true}));
upsellplusapp.init_drawer_offer();
Cart.js
CartJS.getCart();
document.querySelector("#upsellplus_drawer_offer").innerHTML = "";
upsellplusapp.init_drawer_offer();
Venue
document.querySelector("#upsellplus_drawer_offer").innerHTML = "";
document.querySelector('form.cart input.ajaxcart__qty-num').dispatchEvent(new Event("change", { bubbles: true }));
upsellplusapp.init_drawer_offer();
Venture
document.querySelector("#upsellplus_drawer_offer").innerHTML = "";
fetchCart();
upsellplusapp.init_drawer_offer();
Broadcast
document.querySelector("#upsellplus_drawer_offer").innerHTML = "";
cart.getCart();
upsellplusapp.init_drawer_offer();
Shella
document.querySelector("#upsellplus_drawer_offer").innerHTML = "";
theme.cart.updateData()
setTimeout(() => { theme.cart.updateCart(); }, 1000);
Dawn
document.querySelector("#upsellplus_drawer_offer").innerHTML = "";
document.querySelector("#upsellplus_drawer_offer").innerHTML = ""; ajaxCart.load();
upsellplusapp.init_drawer_offer();
Testament
document.querySelector("#upsellplus_drawer_offer").innerHTML = "";
Shopify.getCart(ajaxifyShopify.buildCart);
upsellplusapp.init_drawer_offer();
Refresh
document.querySelector("#upsellplus_drawer_offer").innerHTML = "";
document.querySelector('form.cart__contents input.quantity__input').dispatchEvent(new Event("change", { bubbles: true }));
upsellplusapp.init_drawer_offer();
Foxpad
document.querySelector("#upsellplus_drawer_offer").innerHTML = "";
document.querySelector('form.cart-flyout__form input.quantity').dispatchEvent(new Event("change"));
upsellplusapp.init_drawer_offer();
Athens
document.querySelector("#upsellplus_drawer_offer").innerHTML = "";
document.querySelector('form.mini-cart-inner input.quantity-input-field').dispatchEvent(new Event("change", { bubbles: true }));
upsellplusapp.init_drawer_offer();
Vella Framework
$('.drawerProductQty .qtyNum').first().trigger("change");
$("#upsellplus_drawer_offer").innerHTML = "";
upsellplusapp.init_drawer_offer();
Sense
document.querySelector("#upsellplus_drawer_offer").innerHTML = "";
document.querySelector('form.cart__contents input.quantity__input').dispatchEvent(new Event("change", { bubbles: true }));
upsellplusapp.init_drawer_offer();
Baseline
document.querySelector("#upsellplus_drawer_offer").innerHTML = "";
document.body.dispatchEvent(new CustomEvent("baseline:modalcart:afteradditem"))
upsellplusapp.init_drawer_offer();
Go Live
document.querySelector("#upsellplus_drawer_offer").innerHTML = "";
$("form.cart-form .cart__qty-input").first().trigger("change");
upsellplusapp.init_drawer_offer();
Expanse
document.querySelector("#upsellplus_drawer_offer").innerHTML = "";
document.dispatchEvent(new CustomEvent('cart:build'));
upsellplusapp.init_drawer_offer();
Starter
setTimeout(function(){
$(window).trigger('updateCart');
}, 100)
Plantco
document.documentElement.dispatchEvent(new CustomEvent('wrapped:custom:update', {bubbles: true}));
Craft
document.querySelector("#upsellplus_drawer_offer").innerHTML = "";
document.querySelector('form.cart__contents input.quantity__input').dispatchEvent(new Event("change", { bubbles: true }));
upsellplusapp.init_drawer_offer();
Updated on: 10/03/2025
Thank you!