The version of my magento2 is 2.3.5-p1.
Here is the problem: We will open the invoice view in backend. So we go to: ->Sales->orders->select an order ->go to Invoices->view
Does someone has the same issue and were able to fix it? Any ideas how to fix it?
I am happy for any ideas!
Thanks for helping.
public function afterGetTotals(\Magento\Sales\Block\Order\Totals $subject, ?array $totals)
{
if (!is_array($totals)) {
return null;
}
foreach ($totals as $total) {
if ($total->getCode() == 'discount') {
if ($this->_coreRegistry->registry('current_order')->getAppliedRuleIds() == self::POS_CUSTOM_DISCOUNT
&& $this->_coreRegistry->registry('current_order')->getOsPosCustomDiscountAmount()) {
$label = "Custom Discount";
if ($this->_coreRegistry->registry('current_order')->getOsPosCustomDiscountType()
== self::PERCENT_PRICE_TYPE) {
$label .= sprintf(
" (%.2f%%)",
$this->_coreRegistry->registry('current_order')->getOsPosCustomDiscountAmount()
);
}
$total->setLabel($label);
}
}
}
return $totals;
}