我已经从2.6.14更新到WC 3.0.1.
我原来的代码如下:
add_action( 'woocommerce_before_calculate_totals', 'add_custom_price' );
function add_custom_price( $cart_object ) {
$custom_price = 10; // This will be your custome price
foreach ( $cart_object->cart_contents as $key => $value ) {
$value['data']->price = $custom_price;
}
}
Run Code Online (Sandbox Code Playgroud)
它不再更新购物车或迷你车的价格.
woocommerce ×1