You are here

protected function CartBlockBase::createPrice in Commerce Cart Blocks 8

1 call to CartBlockBase::createPrice()
CartBlockBase::getTotal in src/Plugin/Block/CartBlockBase.php
Gets the total price of the carts.

File

src/Plugin/Block/CartBlockBase.php, line 250

Class

CartBlockBase
CartBlockBase class.

Namespace

Drupal\commerce_cart_blocks\Plugin\Block

Code

protected function createPrice($amount) {

  /** @var \Drupal\commerce_store\StoreStorageInterface $storage */
  $storage = $this->entityTypeManager
    ->getStorage('commerce_store');
  $defaultStore = $storage
    ->loadDefault();
  $currencyCode = $defaultStore ? $defaultStore
    ->getDefaultCurrencyCode() : 'USD';
  return new Price($amount, $currencyCode);
}