You are here

public function Invoice::addAdjustment in Commerce Invoice 8.2

Adds an adjustment.

Parameters

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

Return value

$this

Overrides EntityAdjustableInterface::addAdjustment

File

src/Entity/Invoice.php, line 327

Class

Invoice
Defines the invoice entity class.

Namespace

Drupal\commerce_invoice\Entity

Code

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