You are here

function commerce_coupon_remove_coupon_from_order_callback in Commerce Coupon 7.2

Page callback: remove coupon from order.

Parameters

object $coupon: A coupon object.

object $order: The order that the coupon belongs to.

Return value

int|void Access denied bit or void.

1 string reference to 'commerce_coupon_remove_coupon_from_order_callback'
commerce_coupon_menu in ./commerce_coupon.module
Implements hook_menu().

File

./commerce_coupon.module, line 504
Provides coupon functionality for Drupal Commerce.

Code

function commerce_coupon_remove_coupon_from_order_callback($coupon, $order) {
  if (!isset($_GET['token']) || !drupal_valid_token($_GET['token'], 'commerce_coupon_remove_checkout:' . $coupon->coupon_id . ':' . $order->order_id) || !commerce_checkout_access($order)) {
    return MENU_ACCESS_DENIED;
  }
  commerce_coupon_remove_coupon_from_order($order, $coupon);
  drupal_set_message(t('Coupon removed from order'));
  drupal_goto();
}