You are here

public function PromotionUsage::deleteByCoupon in Commerce Core 8.2

Deletes all usage for the given coupons.

Parameters

\Drupal\commerce_promotion\Entity\CouponInterface[] $coupons: The coupons.

Overrides PromotionUsageInterface::deleteByCoupon

File

modules/promotion/src/PromotionUsage.php, line 66

Class

PromotionUsage

Namespace

Drupal\commerce_promotion

Code

public function deleteByCoupon(array $coupons) {
  $this->connection
    ->delete('commerce_promotion_usage')
    ->condition('coupon_id', EntityHelper::extractIds($coupons), 'IN')
    ->execute();
}