Change cart item prices in Woocommerce 3
I am trying to change product price in cart using the following function: add_action( 'woocommerce_before_shipping_calculator', 'add_custom_price' ); function add_custom_price( $cart_object ) { foreach ( $cart_object->cart_contents as $key => $value ) { $value['data']->price = 400; } } It was working correctly in WooCommerce version 2.6.x but not working anymore in version 3.0+ How can I make it work in WooCommerce Version 3.0+? Thanks. Update (September 2018) With WooCommerce version 3.0+ you need: To use woocommerce_before_calculate_totals hook instead. To use WC_Cart get_cart() method