Allow order totals to be updated (v. 2.93)

The 2.9 releases automatically tally the subtotal and total values for you, when you add or edit an order. If you'd like to control those values, and allow a client to edit those fields, you can use the following adjustments:

  1. Open the orders.php file from the /storeadmin/ folder.

  2. Change the code:

    $subtotal = number_format((float)$subtotal, 2, '.', '');
    $total = $subtotal - $discount - $vval + $tax + $shipping;

    to:

    $subtotal = (!empty($_POST['sub_total'])) ? $_POST['sub_total'] : number_format((float)$subtotal, 2, '.', '');
    $subtotal = number_format((float)$subtotal, 2, '.', '');
    $total = (!empty($_POST['grand_total']) AND $_POST['grand_total'] >= $subtotal) ? $_POST['grand_total'] : ($subtotal - $discount - $vval + $tax + $shipping);
  3. Change the code:

     0 ? "$Currency" . $subtotal : ''); ?>

    to:

    $Currency"; ?>" class="tinyinput" style="border: none; background: none;" tabindex="-1">
  4. Change the code:

     0 ? "$Currency" . $total : ''); ?>

    to:

    $Currency"; ?>" class="tinyinput" style="border: none; background: none;" tabindex="-1">