You are here

function uc_coupon_workflow_apply in Ubercart Discount Coupons 7.3

Same name and namespace in other branches
  1. 7.2 uc_coupon_workflow/uc_coupon_workflow.rules.inc \uc_coupon_workflow_apply()

Action callback to apply a coupon. This simply adds the coupon to the session; it is validated later.

File

uc_coupon_workflow/uc_coupon_workflow.rules.inc, line 271
Rules integration for uc_coupon_workflow

Code

function uc_coupon_workflow_apply($cid, $mode) {
  $coupon = uc_coupon_load($cid);
  if ($coupon->cid) {
    uc_coupon_session_add($coupon->code, $mode);
    return array(
      'coupon' => $coupon,
    );
  }
  else {
    return array(
      'coupon' => NULL,
    );
  }
}