protected function OrderItem::applyAdjustments in Commerce Core 8.2
Applies adjustments to the given price.
Parameters
\Drupal\commerce_price\Price $price: The price.
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 The adjusted price.
2 calls to OrderItem::applyAdjustments()
- OrderItem::getAdjustedTotalPrice in modules/
order/ src/ Entity/ OrderItem.php - Gets the adjusted order item total price.
- OrderItem::getAdjustedUnitPrice in modules/
order/ src/ Entity/ OrderItem.php - Gets the adjusted order item unit price.
File
- modules/
order/ src/ Entity/ OrderItem.php, line 268
Class
- OrderItem
- Defines the order item entity class.
Namespace
Drupal\commerce_order\EntityCode
protected function applyAdjustments(Price $price, array $adjustment_types = []) {
$adjusted_price = $price;
foreach ($this
->getAdjustments($adjustment_types) as $adjustment) {
if (!$adjustment
->isIncluded()) {
$adjusted_price = $adjusted_price
->add($adjustment
->getAmount());
}
}
return $adjusted_price;
}