You are here

function uc_coupon_checkout_apply in Ubercart Discount Coupons 5

Same name and namespace in other branches
  1. 6 uc_coupon.module \uc_coupon_checkout_apply()

Checkout pane AJAX callback.

1 string reference to 'uc_coupon_checkout_apply'
uc_coupon_menu in ./uc_coupon.module
Implementation of hook_menu().

File

./uc_coupon.module, line 1089
Provides discount coupons for Ubercart.

Code

function uc_coupon_checkout_apply() {
  $coupon = uc_coupon_validate($_POST['code']);
  if ($coupon->valid) {
    $_SESSION['uc_coupon'] = $_POST['code'];
    $coupon->message = t('The coupon has been applied to your order.');
  }
  drupal_set_header("Content-Type: text/javascript; charset=utf-8");
  print drupal_to_js($coupon);
  exit;
}