You are here

function uc_coupon_price in Ubercart Discount Coupons 6

Run price alterers on a coupon value.

3 calls to uc_coupon_price()
uc_coupon_submit in ./uc_coupon.module
Submit a coupon from checkout page or block.
uc_coupon_token_values in ./uc_coupon.module
Implementation of hook_token_values().
uc_coupon_uc_cart_alter in ./uc_coupon.module
Implementation of hook_uc_cart_alter().

File

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

Code

function uc_coupon_price($amount, $revision = 'formatted') {
  $context = array(
    'revision' => $revision,
    'type' => 'line_item',
    'subject' => array(
      'order' => (object) array(
        'products' => uc_cart_get_contents(),
      ),
      'line_item' => array(
        'type' => 'coupon',
        'amount' => $amount,
        'weight' => 0,
      ),
    ),
  );
  return uc_price($amount, $context);
}