WooCommerce中特定选定付款方式的圆形购物车总数
如果有人在交货时选择现金,我需要在结帐时汇总最终价格
。我想实现的目标是:
if payment_method == 'cod'{
$cart_subtotal = round($cart_subtotal);
}
I need to round the final price at the checkout if someone chooses Cash on Delivery
The general idea of what I would like to achieve is:
if payment_method == 'cod'{
$cart_subtotal = round($cart_subtotal);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,请确保每次用户更改付款方式时都会重新计算购物车的总计:
根据您想要实现的逻辑,有很多方法可以使价格汇总,但这是最简单的方法总计如果用户选择“现金交货”作为付款方式:
First of all, make sure that the cart totals will be re-calculated every time a user changes the payment method:
There are many ways to round a price depending on what logic you want to achieve, but here's the most simple way to round the total if a user has chosen "Cash on delivery" as their payment method: