在Woocommerce购物车页面上的数量更改时自动更新购物车 [英] Auto update cart on quantity change in Woocommerce cart page

查看:660
本文介绍了在Woocommerce购物车页面上的数量更改时自动更新购物车的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有5美元的费用,使用说货到付款"时,该费用会加到订单总额中.切换到银行转帐"时,应免除此费用.当我说通过更改帐单邮编来触发订单检查表更新时,这笔费用就被删除了.但是我需要它在选择其他支付网关时也能触发.

I have a $5 fee that gets added to the order total when using lets say "Cash on Delivery". This fee should be removed when switching to "bank transfer". This fee gets removed just fine when I trigger the order review table to update by lets say changing the billing zip code. But I need it to also trigger when selecting a different payment gateway.

这是我当前的代码:

<script>
    $('#payment_method_bacs').on('click', function() {
    $( 'body' ).trigger( 'update_checkout' );})
</script>

有什么想法吗?

推荐答案

只是让这个问题对以后在这里阅读的任何人有用..这是最终为我工作的脚本.我从此有用的指南中找到了答案.

Just to make this question somewhat useful for anyone who reads here in the future.. here is the script that ended up working for me. I found the answer here from this helpful guide.

    jQuery('div.woocommerce').on('click', 'input.qty', function(){ 

        jQuery("[name='update_cart']").trigger("click");

    }); 

这篇关于在Woocommerce购物车页面上的数量更改时自动更新购物车的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆