【发布时间】:2022-11-03 20:26:05
【问题描述】:
一直在寻找一种简单的方法来为运输插件的所有订单添加 400 克以获得正确的重量。看了Cart total Weight and Shipping Recalculation on WooCommerce 但不需要所有这些
【问题讨论】:
-
@Barnabas 任何提示?
-
@标签不起作用,除非该人已经与问题进行了交互
标签: woocommerce
一直在寻找一种简单的方法来为运输插件的所有订单添加 400 克以获得正确的重量。看了Cart total Weight and Shipping Recalculation on WooCommerce 但不需要所有这些
【问题讨论】:
@ 标签不起作用,除非该人已经与问题进行了交互
标签: woocommerce
您可能需要先更改您的重量单位WooCommerce > 设置 > 产品 > 测量部分。
然后在您的 functions.php 中使用以下过滤器挂钩来覆盖购物车的总重量。
add_filter('woocommerce_cart_contents_weight','add_package_weight_to_cart_contents_weight');
function add_package_weight_to_cart_contents_weight( $weight ) {
$weight = 400; // change to your expected cart content weight.
return $weight;
}
请注意,当您向主题添加自定义代码时,建议使用儿童。
【讨论】: