cart abandonment rate shopify code example
Example 1: clear cart shopify
<a href="/cart/clear" class="btn clear-cart">Empty Cart</a>
<script>
$(function() {
$('.clear-cart').on('click',function(e){
e.preventDefault();
$.ajax({
type: "POST",
url: '/cart/clear.js',
success: function(){
alert('You cleared the cart!');
},
dataType: 'json'
});
})
});
</script>
Example 2: cart page route in shopify
{{ routes.cart_url }}