You are here

public function PriceItem::toPrice in Commerce Core 8.2

Gets the Price value object for the current field item.

Return value

\Drupal\commerce_price\Price The Price value object.

File

modules/price/src/Plugin/Field/FieldType/PriceItem.php, line 170

Class

PriceItem
Plugin implementation of the 'commerce_price' field type.

Namespace

Drupal\commerce_price\Plugin\Field\FieldType

Code

public function toPrice() {
  return new Price($this->number, $this->currency_code);
}