public function Adjustment::add in Commerce Core 8.2
Adds the given adjustment to the current adjustment.
Parameters
\Drupal\commerce_order\Adjustment $adjustment: The adjustment.
Return value
static The resulting adjustment.
File
- modules/
order/ src/ Adjustment.php, line 226
Class
- Adjustment
- Represents an adjustment.
Namespace
Drupal\commerce_orderCode
public function add(Adjustment $adjustment) : Adjustment {
$this
->assertSameType($adjustment);
$this
->assertSameSourceId($adjustment);
$definition = [
'amount' => $this->amount
->add($adjustment
->getAmount()),
] + $this
->toArray();
return new static($definition);
}