[英]Update Cart automatically Using Increment and decrement Button in cart page Magento 2
I have included + and - to increment and decrement the quantity of a product in the cart page. 我已经在购物车页面中添加了+和-来增加和减少产品的数量。 Now i need to update it automatically without clicking the update shopping cart button. 现在,我需要自动更新它,而无需单击更新购物车按钮。 How can i do that? 我怎样才能做到这一点? Kindly help me to fix this problem 请帮助我解决这个问题
Use jQuery ajax() Method ajax function tutorial 使用jQuery ajax()方法ajax函数教程
<button type="button" name="button" id="button-minus"> - </button>
<script>
$(document).ready(function(){
var count = 0;
$("#button-minus").click(function(){
if ( count > 0 ){
$.ajax({url: "url here", success: function(result){
$("#div").html(result);
count--;
}});
}
});
});
</script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.