I have my checkout cart like this
product price quantity total
apple 50 1 50
orange 40 1 40
I need to change the total on the right side to say 20
Code I tried i will put on comment box
but it changes the price.I only need to change the total.Any ideas?
Try with this piece of code in the functions.php file:
if(is_cart()){
add_action( 'woocommerce_before_calculate_totals', 'add_custom_price' );
function add_custom_price( $cart_object )
{
global $woocommerce;
$custom_price = $_POST["custom_prc"];
foreach ( $cart_object->cart_contents as $key => $value )
{
$value['data']->price = $custom_price;
}
}
}