Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Price.php
Go to the documentation of this file.
1 <?php
7 
11 
16 class Price extends AbstractCart
17 {
21  protected $shippingRate;
22 
26  protected $priceCurrency;
27 
35  public function __construct(
36  \Magento\Framework\View\Element\Template\Context $context,
37  \Magento\Customer\Model\Session $customerSession,
38  \Magento\Checkout\Model\Session $checkoutSession,
40  array $data = []
41  ) {
42  $this->priceCurrency = $priceCurrency;
43  parent::__construct($context, $customerSession, $checkoutSession, $data);
44  }
45 
53  {
54  $this->shippingRate = $shippingRate;
55  return $this;
56  }
57 
63  public function getShippingRate()
64  {
65  return $this->shippingRate;
66  }
67 
73  public function getShippingPrice()
74  {
75  return $this->priceCurrency->convertAndFormat($this->shippingRate->getPrice());
76  }
77 }
setShippingRate(Rate $shippingRate)
Definition: Price.php:52
__construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Customer\Model\Session $customerSession, \Magento\Checkout\Model\Session $checkoutSession, PriceCurrencyInterface $priceCurrency, array $data=[])
Definition: Price.php:35