dimanche 14 juin 2015

Change order total amount in prestashop after payment method choosing

If you like to change the order total amount, to add an extra fee or something else after choosing a payment method by the client. You can do it by overriding the validateOrder method, in classes/PaymentModule.php, and change it like this, for prestashop 1.6.0.13, change the instruction in line 13 by

if($payment_method == 'Bank wire')     
$order->total_paid_tax_incl = (float)Tools::ps_round((float)$this->context->cart->getOrderTotal(true, Cart::BOTH, $order->product_list, $id_carrier)*1.25, 2);

In this example, i added a 25% extra fee to order total amount when the payment method is bankwire. Hope this helps.

0 commentaires :

Enregistrer un commentaire