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