public function Promotion::clear in Commerce Core 8.2
Allows a promotion to clean up any modifications done to the given order.
Parameters
\Drupal\commerce_order\Entity\OrderInterface $order: The order.
Overrides PromotionInterface::clear
File
- modules/
promotion/ src/ Entity/ Promotion.php, line 613
Class
- Promotion
- Defines the promotion entity class.
Namespace
Drupal\commerce_promotion\EntityCode
public function clear(OrderInterface $order) {
$offer = $this
->getOffer();
if ($offer instanceof OrderItemPromotionOfferInterface) {
foreach ($order
->getItems() as $order_item) {
$offer
->clear($order_item, $this);
}
}
else {
$offer
->clear($order, $this);
}
}