这是覆盖购物车中产品价格的代码
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; // for WooCommerce version 3+ use: // $value['data']->set_price($custom_price); }}希望它会有用…



