[英]Shopify Liquid: Remove all products added to Cart Page after “OnClick” Submit Button
I have custom Submit Button and I want to remove all Products was Added in Cart Page once I clicking on this Submit button:我有自定义提交按钮,我想在单击此提交按钮后删除所有已添加到购物车页面的产品:
<button class="button_get order_button btn btn-pink js_submit button__text orderButton" id="send" type="submit">Submit</button>
Thank you for your time & help!感谢您的时间和帮助!
Send a request to /cart/clear
eg向
/cart/clear
发送请求,例如
<button onclick="clearCart();">Clear cart</button>
<script>
function clearCart() {
var xhrClearCart = new XMLHttpRequest();
xhrClearCart.open('POST', '/cart/clear.js', true);
xhrClearCart.onload = alert("Cart is empty!");
xhrClearCart.send();
}
</script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.