You are here

function uc_coupon_session_clear in Ubercart Discount Coupons 7.3

Same name and namespace in other branches
  1. 7.2 uc_coupon.module \uc_coupon_session_clear()

Removes one (or all) coupon codes from the session.

Parameters

$code: The code to remove, or NULL to remove all codes.

$is_update: TRUE (the default) if removing this code represents an update of the session; that is, if the code was previously validated. FALSE otherwise (e.g. for removal of automatic discounts). Ignored if a specific code is not specified.

4 calls to uc_coupon_session_clear()
uc_coupon_form_submit in ./uc_coupon.module
Submit handler for the uc_coupon form.
uc_coupon_session_validate in ./uc_coupon.module
Validates all coupons in the current session. The validated coupons are statically cached for each request. The cache is rebuilt the first time this function is called, or every time the cart contents are rebuilt.
uc_coupon_uc_checkout_complete in ./uc_coupon.module
Implements hook_uc_checkout_complete().
uc_coupon_uc_update_cart_item in ./uc_coupon.module
Implements hook_uc_update_cart_item(). Remove a coupon from the order when the "Remove" button is clicked.

File

./uc_coupon.module, line 477
Provides discount codes and gift certificates for Ubercart.

Code

function uc_coupon_session_clear($code = NULL) {
  if (isset($code)) {
    unset($_SESSION['uc_coupons'][$code]);
  }
  else {
    unset($_SESSION['uc_coupons']);
  }
}