You are here

public function InvoiceItem::setUnitPrice in Commerce Invoice 8.2

Sets the invoice item unit price.

Parameters

\Drupal\commerce_price\Price $unit_price: The invoice item unit price.

Return value

$this

Overrides InvoiceItemInterface::setUnitPrice

File

src/Entity/InvoiceItem.php, line 140

Class

InvoiceItem
Defines the invoice item entity class.

Namespace

Drupal\commerce_invoice\Entity

Code

public function setUnitPrice(Price $unit_price) {
  $this
    ->set('unit_price', $unit_price);
  $this
    ->recalculateTotalPrice();
  return $this;
}