Skip to main content
Cart Drawer Refresh Code (New UI)
Lasandra Miller avatar
Written by Lasandra Miller
Updated over a month ago

If your store uses a cart drawer, pop-up cart, or slide cart and you want to upsell in these carts, then In Cart Upsell is the app for you! Below is an example of how these carts look.


The ”Cart Drawer Refresh” code is used to prevent the redirect to the cart page when the upsell generated by In Cart Upsell is added to the cart. So, what the code does is ensure that your shoppers remain in the cart drawer ”Cart Drawer” after they add the upsell. These codes are unique to your theme and are normally given by your theme’s developers. Over the years In Cart Upsell has collected Cart Drawer Refresh Code for some common themes.

The first thing you need to know is the name of your theme. Once you know that you can go ahead and search our list of “Refresh Codes” for your theme name. After locating your theme name, copy the refresh code and paste it in the app by going to settings, click Cart Drawer, and then paste the copied code in the text box provided for the Cart Drawer Refresh Code.

Theme Name

Refresh Code

Athens

document.querySelector('.nudge-offer').remove();

document.querySelector('form.mini-cart-inner input.quantity-input-field').dispatchEvent(new Event("change", { bubbles: true }));

InCartUpsell.prototype.findOfferWhenReady();

Atlantic

$('.nudge-offer').remove()

fetch('/cart?view=mini', {

credentials: 'same-origin',

method: 'GET'

}).then(function (content) {

content.text().then(function(html){

$('.cart-mini-content').html(html.replace('<script class="cartFlagX"></script>','').replace('<template data-options>','').replace('{}','').replace('</template>','').replace('<template data-html="content">','').replace('<template data-html="footer">',''))

$('.cart-mini-content .cart-mini-subtotal').remove()

$('.cart-mini-content .cart-mini-actions').remove()

$('.cart-mini-content .cartdrawer-information-header').remove()

})

})

$('.quantity .field').trigger('change');<br>

Baseline

document.querySelector(".nudge-offer").remove();

document.body.dispatchEvent(new CustomEvent("baseline:modalcart:afteradditem"))

InCartUpsell.prototype.findOfferWhenReady();

Booster

HsCartDrawer.updateSlideCart();

Broadcast

document.querySelector(".nudge-offer").remove();

cart.getCart();

InCartUpsell.prototype.findOfferWhenReady();

Brooklyn

document.querySelector(".nudge-offer").remove();

ajaxCart.load();

InCartUpsell.prototype.findOfferWhenReady();

Cart.js

CartJS.getCart(); document.querySelector('.nudge-offer').remove(); InCartUpsell.prototype.findOfferWhenReady();

Colors

document.querySelector('.nudge-offer').remove();

document.querySelector('form.ajaxcart input.ajaxcart__qty-num').dispatchEvent(new Event("change", { bubbles: true }));

InCartUpsell.prototype.findOfferWhenReady();

Dawn

document.querySelector('.nudge-offer').remove();

document.querySelector('.nudge-offer').remove(); ajaxCart.load(); InCartUpsell.prototype.findOfferWhenReady();

Debut

closeAjaxCart();

ajaxCartUpdate();

Debutify

document.querySelector('.nudge-offer').remove();

theme.ajaxCart.update();

InCartUpsell.prototype.findOfferWhenReady();

------- OR -------

$(".nudge-offer").remove(); $("form.ajaxcart .ajaxcart__qty-num").first().trigger("change"); setTimeout( function(){ InCartUpsell.prototype.findOfferWhenReady(); }, 3000);

------- OR --------

Look for the following line in theme.js.liquid (Get collab access) and change it

FROM
module = {init: init};

TO
module = {
init: init,
__lcart: loadCart
};

Then the refresh code will be

AjaxCart.__lcart();

$(".nudge-offer").remove();

Editorial

$.ajax({

url: "/cart.js",

type: "GET",

_sellify: sellify,

success: function(resp){ this._sellify.ucd.helpers.ajaxCart.buildCart(resp); }

});

Ella

document.querySelector('.nudge-offer').remove();

document.querySelector('div.has-items input.item-quantity').dispatchEvent(new Event("change", { bubbles: true }));

InCartUpsell.prototype.findOfferWhenReady();

Expanse

document.querySelector('.nudge-offer').remove();

document.dispatchEvent(new CustomEvent('cart:build'));

InCartUpsell.prototype.findOfferWhenReady();

Flex

document.querySelector(".nudge-offer").remove();

Shopify.theme.jsAjaxCart.updateView();

InCartUpsell.prototype.findOfferWhenReady();

Flow

document.querySelector('.nudge-offer').remove();

document.querySelector('form.cart input.ajaxcart__qty-num').dispatchEvent(new Event("change", { bubbles: true }));

InCartUpsell.prototype.findOfferWhenReady();

Focal

document.querySelector('.nudge-offer').remove();

document.documentElement.dispatchEvent(new CustomEvent('cart:refresh', {bubbles: true}));

InCartUpsell.prototype.findOfferWhenReady();

FoxPad

document.querySelector('.nudge-offer').remove();

document.querySelector('form.cart-flyout__form input.quantity').dispatchEvent(new Event("change"));

InCartUpsell.prototype.findOfferWhenReady();

Go Live

document.querySelector('.nudge-offer').remove();

$("form.cart-form .cart__qty-input").first().trigger("change");

InCartUpsell.prototype.findOfferWhenReady();

Impulse

document.querySelector('.nudge-offer').remove();

$("form.ajaxcart .js-qty__num").first().trigger("change");

InCartUpsell.prototype.findOfferWhenReady();

or

document.querySelector('.nudge-offer').remove();

document.dispatchEvent(new CustomEvent('cart:build'));

InCartUpsell.prototype.findOfferWhenReady();

Minimal

$.getJSON("/cart.js", function(cart) {

refreshCart(cart);

});

Motion

var ajcresp = theme.cart.getCart();

try{

(new theme.CartDrawer()).buildCart(ajcresp.responseJSON);

}

catch (e){

var oa = 1;

}

Narrative

$(".nudge-offer").remove();

$("form.cart-drawer .cart-drawer__item-quantity").first().trigger("input");

Parallax

ajaxUpdateCart(1, $(this).val(), $(this).parents('#cart'));<br>

Pipeline

Shopify.getCart(ajaxifyShopify.buildCart);!Important: Change Line 1131 in Ajaxify.js.liquidFROMmodule = {

init: init

};TOmodule = {

init: init,

buildCart: buildCart;

};

document.querySelector('.nudge-offer').remove();

document.querySelector('div.drawer__content input.quantity__input').dispatchEvent(new Event("change", { bubbles: true }));

InCartUpsell.prototype.findOfferWhenReady();

Pop

document.querySelector('.nudge-offer').remove();

document.querySelector('div.ajaxifyCart--content input.ajaxifyCart--num').dispatchEvent(new Event("change", { bubbles: true }));

InCartUpsell.prototype.findOfferWhenReady();

Prestige

fetch('/cart?view=drawer&timestamp=' + Date.now(), {

credentials: 'same-origin',

method: 'GET'

}).then(function (content) {

content.text().then(function(html){

document.getElementById("sidebar-cart").innerHTML = html;

document.getElementById("sidebar-cart").children[0].setAttribute("aria-hidden", "false");

})

})

OR

jQuery.get('/cart?view=drawer&timestamp=' + Date.now(), function(data, textStatus, jqXHR) {

jQuery("#sidebar-cart").html(jQuery(jQuery.parseHTML(data)).filter("#sidebar-cart").html());

jQuery("#sidebar-cart").attr("aria-hidden", false);

jQuery("#sidebar-cart").attr("tabindex", "-1");

if (navigator.userAgent.match(/(iPod|iPhone|iPad)/)) {

if (browserRatio >= 1.5) {

jQuery("#sidebar-cart").attr("style", "min-height: 360px;");

} else {

jQuery("#sidebar-cart").attr("style", "min-height: 555px;");

}

} else {

jQuery("#sidebar-cart").attr("style", "height: 100vh !important;");

}

});

OR

document.querySelector('.nudge-offer').remove();

document.documentElement.dispatchEvent(new CustomEvent('cart:refresh', {bubbles: true}));

InCartUpsell.prototype.findOfferWhenReady();

Refresh

document.querySelector('.nudge-offer').remove();

document.querySelector('form.cart__contents input.quantity__input').dispatchEvent(new Event("change", { bubbles: true }));

InCartUpsell.prototype.findOfferWhenReady();

Ride

document.querySelector('.nudge-offer').remove();
document.querySelector('form.cart__contents input.quantity__input').dispatchEvent(new Event("change", { bubbles: true }));
InCartUpsell.prototype.findOfferWhenReady();

Sense

document.querySelector('.nudge-offer').remove();

document.querySelector('form.cart__contents input.quantity__input').dispatchEvent(new Event("change", { bubbles: true }));

InCartUpsell.prototype.findOfferWhenReady();

Shella

document.querySelector('.nudge-offer').remove();

theme.cart.updateData()

setTimeout(() => { theme.cart.updateCart(); }, 1000);

SlideCart

window.SLIDECART_UPDATE();

OR

window.SLIDECART_UPDATE(function() {

window.SLIDECART_OPEN()

});

Full list of SlidecartHQ callbacks

https://apphq.co/documentation/slide-cart-callbacks-and-methods

Starter

setTimeout(function(){

$(window).trigger('updateCart');

}, 100)

Streamline

theme.cart._updateCart();

$(".nudge-offer").fadeOut(400,function(){ $(".nudge-offer").remove() });

OR

document.dispatchEvent(new CustomEvent("cart:build"))

document.querySelector(".nudge-offer").remove();

InCartUpsell.prototype.findOfferWhenReady();

Supply

$(".nudge-offer").remove();

$("form.cart-form .ajaxifyCart--num").first().trigger("change");

setTimeout(function(){ InCartUpsell.prototype.findOfferWhenReady(); },3000);

Testament

document.querySelector('.nudge-offer').remove();

Shopify.getCart(ajaxifyShopify.buildCart);

InCartUpsell.prototype.findOfferWhenReady();

Turbo

$("[data-cart-quantity-input]").first().clone(true,true).val(1).css("display","none").appendTo($("[data-cart-quantity-input]").first().closest(".product-quantity-box")).trigger("change");

OR

$("input.quantity").first().clone(true,true).val(1).css("display","none").appendTo($("input.quantity").first().closest(".product-quantity-box")).trigger("change");

Vella Framework

$('.drawerProductQty .qtyNum').first().trigger("change");

$(".nudge-offer").remove();

InCartUpsell.prototype.findOfferWhenReady();

Venture

document.querySelector(".nudge-offer").remove();

fetchCart();

InCartUpsell.prototype.findOfferWhenReady();

Venue

document.querySelector('.nudge-offer').remove();

document.querySelector('form.cart input.ajaxcart__qty-num').dispatchEvent(new Event("change", { bubbles: true }));

InCartUpsell.prototype.findOfferWhenReady();

document.querySelector('.nudge-offer').remove();

document.querySelector('.cart-item__qty cart-item-quantity input').dispatchEvent(new Event("change", { bubbles: true }));

InCartUpsell.prototype.findOfferWhenReady();

Vision

document.querySelector('.nudge-offer').remove();

document.documentElement.dispatchEvent(new CustomEvent('cart:refresh', {bubbles: true}));

InCartUpsell.prototype.findOfferWhenReady();

Warehouse

document.querySelector('.nudge-offer').remove();

document.documentElement.dispatchEvent(new CustomEvent('cart:refresh', {

bubbles: true}));

InCartUpsell.prototype.findOfferWhenReady();

Zen

document.querySelector('.nudge-offer').remove();

document.querySelector('div.ajaxifyCart--content input.ajaxifyCart--num').dispatchEvent(new Event("change", { bubbles: true }));

InCartUpsell.prototype.findOfferWhenReady();

Did this answer your question?