php - WooCommerce 在购物车页面中获取项目明智的运费
问题描述
我正在 WooCommerce 中寻找一种方法来获取/获取购物车中的单个运费。
foreach (WC()->cart->get_cart() as $hash => $item) {
# get $item wise shipping price.
}
我检查了/woocommerce/includes/class-wc-cart.php
类,我只发现get_cart_shipping_total()
返回整个运费而不是每个产品的单独运费。
TL;博士
如果有人可以指导我,我将不胜感激。
提前致谢。
解决方案
推荐阅读
- azure - Azure B2C - 使用 Graph API 将 IdentityProvider 链接到 UserFlow 导致 403
- ios - 用于代理流量的 PAC 脚本,iOS
- c# - 如何让 Asp.Net Core 返回正确的视图
- r - Rstudio 支持 S4 方法自动完成
- sql - 在 Amazon Redshift 中将纪元转换为时间戳的函数
- wordpress - Wordpress 插件开发 - 防止致命错误
- pyspark - 如何将变量传递给 UDAF(用户定义聚合函数)
- python - 在大型 numpy 数组上调用一般耗时函数的有效方法
- python - 使用 pygame 显示不同样式的项目符号
- python-3.x - 使用记忆化的硬币找零问题(亚马逊面试问题)