woocommerce_before_calculate_totals hook stopped working after update to WC 3.0.1

Just updated to WC 3.0.1 from 2.6.14
The code which I had used earlier is in this format

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;
    }
}

but now it not updating price in cart or in minicart

Thanks in advanced

Read more here: woocommerce_before_calculate_totals hook stopped working after update to WC 3.0.1

Leave a Reply

Your email address will not be published. Required fields are marked *