kaloian
4/11/2020 - 8:51 PM

Empty cart button AJAX

<button id="deletecart">EMPTY CART</button>

<script>
  $('#deletecart').click(function (e) {
  e.preventDefault();
   $.ajax({
      type: "POST",
      url: '/cart/clear.js',
      success: function(){
         document.location.href = '/collections/all;
      },
      dataType: 'json'
    });
  });
</script>