function uc_payment_uc_payment_method_checkout_alter in Ubercart 7.3
Same name and namespace in other branches
- 8.4 payment/uc_payment/uc_payment.module \uc_payment_uc_payment_method_checkout_alter()
Implements hook_uc_payment_method_checkout_alter().
File
- payment/
uc_payment/ uc_payment.module, line 250
Code
function uc_payment_uc_payment_method_checkout_alter(&$methods, $order) {
if (isset($methods['free_order'])) {
if ($order->order_total < 0.01) {
// Unset all other payment methods if this is a free order.
foreach (array_keys($methods) as $key) {
if ($key != 'free_order') {
unset($methods[$key]);
}
}
}
else {
// Disallow this payment method if the order is not free.
unset($methods['free_order']);
}
}
}