/** * Get shipping rate code title and its price or error message * * @param \Magento\Framework\DataObject $rate * @param string $format * @param string $inclTaxFormat * @return string */ public function renderShippingRateOption($rate, $format = '%s - %s%s', $inclTaxFormat = ' (%s %s)') { $renderedInclTax = ''; if ($rate->getErrorMessage()) { $price = $rate->getErrorMessage(); } else { $price = $this->_getShippingPrice($rate->getPrice(), $this->_taxHelper->displayShippingPriceIncludingTax()); $incl = $this->_getShippingPrice($rate->getPrice(), true); if ($incl != $price && $this->_taxHelper->displayShippingBothPrices()) { $renderedInclTax = sprintf($inclTaxFormat, $this->escapeHtml(__('Incl. Tax')), $incl); } } return sprintf($format, $this->escapeHtml($rate->getMethodTitle()), $price, $renderedInclTax); }
/** * Return flag whether to display shipping price including and excluding tax * * @return bool */ public function isDisplayShippingBothPrices() { return $this->taxHelper->displayShippingBothPrices(); }