/*Update below code in functions.php it will change cart page and checkout page*/
add_action( ‘woocommerce_before_calculate_totals’, ‘add_custom_price’ );
function add_custom_price( $cart_object ) {
$custom_price = 0.0;
foreach ( $cart_object->cart_contents as $value ) {
if ( $value[‘product_id’] == $free_id ) {
//Woo-Commerce version below 2.7.0
$value[‘data’]->price = $custom_price;
//Woo-Commerce version above 3.0.0
$value[‘data’]->set_price($custom_price);
}
}
}