You are here

public function OrderItem::removeAdjustment in Commerce Core 8.2

Removes an adjustment.

Parameters

\Drupal\commerce_order\Adjustment $adjustment: The adjustment to remove.

Return value

$this

Overrides EntityAdjustableInterface::removeAdjustment

File

modules/order/src/Entity/OrderItem.php, line 195

Class

OrderItem
Defines the order item entity class.

Namespace

Drupal\commerce_order\Entity

Code

public function removeAdjustment(Adjustment $adjustment) {
  $this
    ->get('adjustments')
    ->removeAdjustment($adjustment);
  if ($this
    ->getOrder()) {
    $this
      ->getOrder()
      ->recalculateTotalPrice();
  }
  return $this;
}