Trigger Off Canvas Cart JS

Hello,

I use to use to use JS to trigger the off canvas cart when someone added an item to their cart. With the new release it does not work. Could you take a look at this code and tell me why it might be broke now? Thanks!!

   var $ = jQuery;
(function($) {
$(document).ready(function(){
$('.add_to_cart_button').click(function() {
setTimeout(function(){
$('.hm9').addClass('x-active');
$('.x-off-canvas.x-off-canvas-right').addClass('x-active');
}, 550);
});
$('.x-off-canvas-close, .x-off-canvas-bg, .x-off-canvas-content').click(function() {
$('.x-off-canvas.x-off-canvas-right').removeClass('x-active');
$('.hm9').removeClass('x-active');
});
});
})(jQuery);

Hi There,

It sounds like you might be having an issue with a third party script. Regretfully, we cannot provide support for third party scripts due to the fact that there is simply no way to account for all of the potential variables at play when using another developer’s script. Because of this, any questions you have regarding setup, integration, or troubleshooting any piece of functionality that is not native to X will need to be directed to the original developer.

Thank you for your understanding.

I understand. Is there a way to trigger the off canvas cart to open when an item is added to the cart?

Hi There,

Unfortunately, that feature is not available out of the box. It is possible with customization but that would outside the scope of our support. Thank you for understanding. Make sure that when adding custom code, there’s no error on the console. Right click on the page > Inspect element > Console tab. You can see errors why the code is not working.