public function InvoiceItem::getAdjustedTotalPrice in Commerce Invoice 8.2
Gets the adjusted invoice item total price.
The adjusted total price is calculated by applying the order item's adjustments to the total price. This can include promotions, taxes, etc.
Parameters
string[] $adjustment_types: The adjustment types to include in the adjusted price. Examples: fee, promotion, tax. Defaults to all adjustment types.
Return value
\Drupal\commerce_price\Price|null The adjusted invoice item total price, or NULL.
Overrides InvoiceItemInterface::getAdjustedTotalPrice
1 call to InvoiceItem::getAdjustedTotalPrice()
- InvoiceItem::getAdjustedUnitPrice in src/
Entity/ InvoiceItem.php - Gets the adjusted invoice item unit price.
File
- src/
Entity/ InvoiceItem.php, line 201
Class
- InvoiceItem
- Defines the invoice item entity class.
Namespace
Drupal\commerce_invoice\EntityCode
public function getAdjustedTotalPrice(array $adjustment_types = []) {
$total_price = $this
->getTotalPrice();
if (!$total_price) {
return NULL;
}
$adjusted_total_price = $this
->applyAdjustments($total_price, $adjustment_types);
$rounder = \Drupal::service('commerce_price.rounder');
$adjusted_total_price = $rounder
->round($adjusted_total_price);
return $adjusted_total_price;
}