How to change order total after checkout in Woocommerce WordPress


This code used to change the order total price after checkout product, this code adds your function.php file in WordPress.

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 );
We Well organized and easy-to-understand Interactive tutorials With lots of examples of how to use Tutorials WordPress, PHP, Bootstrap, Bootstrap 4, HTML, CSS, AJAX, jQuery, Woocommerce, Post, Database, Javascript, Theme, Responsive, Templates.

Leave a Reply

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

Contact us

Fill in the form below or give us a call and we'll contact you. We endeavour to answer all enquiries within 24 hours on business days.