You are here

function commerce_coupon_order_has_discount in Commerce Coupon 7.2

Determine whether an order has a particular discount.

Parameters

object $order: An order entity.

object $discount: A discount entity.

Return value

bool Whether or not the discount was found.

File

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

Code

function commerce_coupon_order_has_discount($order, $discount) {
  $order_discount_ids = commerce_coupon_order_discount_ids($order);
  return in_array($discount->discount_id, $order_discount_ids);
}