/** * Add rule discount description label to address object * * @param Address $address * @param \Magento\SalesRule\Model\Rule $rule * @return $this */ public function addDiscountDescription($address, $rule) { $description = $address->getDiscountDescriptionArray(); $ruleLabel = $rule->getStoreLabel($address->getQuote()->getStore()); $label = ''; if ($ruleLabel) { $label = $ruleLabel; } else { if (strlen($address->getCouponCode())) { $label = $address->getCouponCode(); } } if (strlen($label)) { $description[$rule->getId()] = $label; } $address->setDiscountDescriptionArray($description); return $this; }
/** * {@inheritdoc} */ public function getStoreLabel($store = null) { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getStoreLabel'); if (!$pluginInfo) { return parent::getStoreLabel($store); } else { return $this->___callPlugins('getStoreLabel', func_get_args(), $pluginInfo); } }