empty cart shopify code example
Example: 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>