Latest Post

How to change order total after checkout in Woocommerce

How to change order total after checkout in Woocommerce

How to change order total after checkout in Woocommerce


This code use for change order total price after checkout product, this code add your function.php file.

<?php
add_action( 'woocommerce_checkout_create_order', 'change_total_on_checking', 20, 1 );
function change_total_on_checking( $order ) {
    // Get order total
    echo $total = $order->get_total();

    ## -- Make your checking and calculations -- ##
    $new_total = $total * 2; // <== Fake calculation

    // Set the new calculated total
    $order->set_total( $new_total );

}
?>

No comments