public function BundleItemOrderItem::getUnitPrice in Commerce Product Bundle 8
Gets the bundle item order item unit price.
Return value
\Drupal\commerce_price\Price|null The order item unit price, or NULL.
Overrides BundleItemOrderItemInterface::getUnitPrice
1 call to BundleItemOrderItem::getUnitPrice()
- BundleItemOrderItem::recalculateTotalPrice in src/
Entity/ BundleItemOrderItem.php - Recalculates the bundle item order item total price.
File
- src/
Entity/ BundleItemOrderItem.php, line 120
Class
- BundleItemOrderItem
- Defines the Bundle Item Order Item entity.
Namespace
Drupal\commerce_product_bundle\EntityCode
public function getUnitPrice() {
if (!$this
->get('unit_price')
->isEmpty()) {
return $this
->get('unit_price')
->first()
->toPrice();
}
}