All Collections
Help Articles for Old UI
Troubleshooting
AJAX Refresh Codes For Common Themes
AJAX Refresh Codes For Common Themes
S
Written by Support
Updated over a week ago

THEME

CODE

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();

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();

Colors

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

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

InCartUpsell.prototype.findOfferWhenReady();

Brooklyn

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

ajaxCart.load();

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();

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();

Zen

$('.mini-cart').addClass('mini-cart--reloading');$.ajax('/cart?view=mini-cart-content').then(function(cartContent) {

$('.mini-cart .mini-cart__content').html(cartContent);

$('.mini-cart').removeClass('mini-cart--reloading');

});

Pop

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

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

InCartUpsell.prototype.findOfferWhenReady();

Motion

var ajcresp = theme.cart.getCart();

try{

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

}

catch (e){

var oa = 1;

}

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();

Debut

closeAjaxCart();

ajaxCartUpdate();


Parallax

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


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");


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();

Minimal

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

refreshCart(cart);

});

Supply

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

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

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

Booster

HsCartDrawer.updateSlideCart();

Narrative

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

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

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();

Warehouse

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

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

bubbles: true}));

InCartUpsell.prototype.findOfferWhenReady();

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

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>

Cart.js

CartJS.getCart(); document.querySelector('.nudge-offer').remove(); 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();

Venture

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

fetchCart();

InCartUpsell.prototype.findOfferWhenReady();

Broadcast Theme

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

cart.getCart();

InCartUpsell.prototype.findOfferWhenReady();

Shella Theme

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

theme.cart.updateData()

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

Dawn Theme

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

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

OR

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

window.SLIDECART_UPDATE();

InCartUpsell.prototype.findOfferWhenReady();

Testament

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

Shopify.getCart(ajaxifyShopify.buildCart);

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();

FoxPad

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

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

InCartUpsell.prototype.findOfferWhenReady();

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();

Vella Framework

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

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

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();

Baseline

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

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

InCartUpsell.prototype.findOfferWhenReady();

Go Live

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

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

InCartUpsell.prototype.findOfferWhenReady();

Expanse

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

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

InCartUpsell.prototype.findOfferWhenReady();

Focal

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

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

InCartUpsell.prototype.findOfferWhenReady();

Starter Theme

setTimeout(function(){

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

}, 100)

Did this answer your question?