You are here

public function Order::addAdjustment in Commerce Core 8.2

Adds an adjustment.

Parameters

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

Return value

$this

Overrides EntityAdjustableInterface::addAdjustment

File

modules/order/src/Entity/Order.php, line 358

Class

Order
Defines the order entity class.

Namespace

Drupal\commerce_order\Entity

Code

public function addAdjustment(Adjustment $adjustment) {
  $this
    ->get('adjustments')
    ->appendItem($adjustment);
  $this
    ->recalculateTotalPrice();
  return $this;
}