public function ProductVariation::getPrice in Commerce Core 8.2
Gets the purchasable entity's price.
Return value
\Drupal\commerce_price\Price|null The price, or NULL.
Overrides PurchasableEntityInterface::getPrice
File
- modules/
product/ src/ Entity/ ProductVariation.php, line 205
Class
- ProductVariation
- Defines the product variation entity class.
Namespace
Drupal\commerce_product\EntityCode
public function getPrice() {
if (!$this
->get('price')
->isEmpty()) {
return $this
->get('price')
->first()
->toPrice();
}
}