I want to update cart subtotal in woo-commerce. i am just average in woocommerce. please help me. how can add action for modifying subtotal in woo commerce. i have tried to by this code, but not getting exact. i want to multiply by 12 in subtotal and it should show on cart page.

add_action( 'woocommerce_before_calculate_totals', 'add_custom_price' );
function add_custom_price( $total) {

foreach ( $total->cart_contents as $key => $value ) {

    $modifiedtotal = $total->subtotal * 12; 
    --------------------------------
    //how can get subtotal with multiply by 12 and it should be show on cart page.
}
}

Read more here: How to update sub total in cart in woocommerce?


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: