Magento2: Discount Description does not get displayed on cart page

Created on 1 Mar 2016  Â·  22Comments  Â·  Source: magento/magento2

Preconditions (*)

magento 2.3

Steps to reproduce (*)

On Cart Page only Coupon codes get displayed. There is no provision to display discount description on Cart Page ? Whereas on Order View Page, checkout page summary everywhere the discount description gets displayed.

For Cart page In file: /vendor/magento/module-quote/Model/ResourceModel/Quote/Address/Attribute/Frontend/Discount.php - following coding is there:

$title = __('Discount');
            $couponCode = $address->getQuote()->getCouponCode();
            if (strlen($couponCode)) {
                $title .= sprintf(' (%s)', $couponCode);
            }

Hence, only coupon code gets displayed.

Whereas, For Order view page in file: /vendor/magento/module-sales/Block/Order/Totals.php - following coding is there.

_initTotals()

 if ($this->getSource()->getDiscountDescription()) {
                $discountLabel = __('Discount (%1)', $source->getDiscountDescription());
            } else {
                $discountLabel = __('Discount');
            }

Actual result (*)
I am not sure if this is a feature or a bug, but currently discount is displayed differently on cart page as compared to other pages. Which i think is not correct. This is especially highlighted when a coupon code is added to cart and a custom discount with discount description is added to cart.

Expected result (*)

Discount Description should display on cart page

SalesRule mm19br Fixed in 2.3.x Confirmed Format is valid Ready for Work Reproduced on 2.1.x Reproduced on 2.2.x Reproduced on 2.3.x bug report

Most helpful comment

@ishakhsuvarov This is still an issue in 2.1.7, the supposed fix doesn't work. Please re-open and fix this issue for real.

All 22 comments

@parekhreena Thank you for reporting this issue. We have created an internal ticket MAGETWO-50296 to fix the problem.

@sdzhepa - Thank you

@parekhreena Closing, as the fix for the issue seems to be delivered to the develop branch with the commit a610b45.
Please feel free to reopen if you have any additional questions.

On Magento 2.1.3 still only the coupon code gets displayed regarding discounts. Fixed discount starting at specific cart amount (eg over 75€ -> get 2%) is applied, but no label is displayed, even though one can set it for the cart rule.

It's still an issue in Magento 2.1.4. =/

@ishakhsuvarov This is still an issue in 2.1.7, the supposed fix doesn't work. Please re-open and fix this issue for real.

Can confirm 2.3.1 still has this issue.

Hi @shikhamis11. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.
  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [ ] 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [ ] 5. Add label Issue: Confirmed once verification is complete.

  • [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.

@shikhamis11 Thank you for verifying the issue.

Unfortunately, not enough information was provided to acknowledge ticket. Please consider adding the following:

Once all required information is added, please add label "Issue: Confirmed" again.
Thanks!

:white_check_mark: Confirmed by @shikhamis11
Thank you for verifying the issue. Based on the provided information internal tickets MC-18899, MC-18900 were created

Issue Available: @shikhamis11, _You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself._

Hi @devamitbera. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:

  • [ ] 1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
  • [ ] 2. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [ ] 3. If the issue is not relevant or is not reproducible any more, feel free to close it.


mm19br

@MaxSouza thank you for joining. Please accept team invitation here and self-assign the issue.

Hi @MaxSouza. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:

  • [ ] 1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
  • [ ] 2. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [ ] 3. If the issue is not relevant or is not reproducible any more, feel free to close it.


I don't think this is a valid issue. We don't have enough real estate in cart totals box to show full description, and I have seen merchants use Shopping Cart rule's Description field for internal comments as well. Though this could be a nice feature for some of the merchants, I am not sure if this should be rolled out to everyone.

@kalpmehta I have had many merchants who desperately needed to show their customers which specific discount was applied, instead of just showing the percentage. We definitely need to show the description there, real estate or not. Using the description for internal comments is not a good practice, as the description is displayed in the frontend further down the checkout anyways (unless you remove them). So in my opinion (and as you can see above, many others) this is most definitely a feature that is needed.

@magento i'm working on it

Hi @maxtrezo! :wave:
Thank you for joining. Please accept team invitation :point_right: here :point_left: and self-assign the issue.

Thanks @josefbehr for your feedback.

@maxtrezo We already have an open PR on this. https://github.com/magento/magento2/pull/24595

I have managed to fix it creating a plugin to update the description. It separates description by label

`public function aroundAddDiscountDescription(
\Magento\SalesRule\Model\RulesApplier $subject,
\Closure $proceed,
$address,
$rule
) {
$return = $proceed($address, $rule);

    $description = $address->getDiscountDescriptionArray();
    $ruleLabel = $rule->getStoreLabel($address->getQuote()->getStore());
    $label = '';
    if ($ruleLabel) {
        $label = $ruleLabel;
    } 

    if (strlen($address->getCouponCode())) {
        $label = $address->getCouponCode();

        if ($rule->getDescription()) {
            $label = $rule->getDescription();
        }
    }

    if (strlen($label)) {
        $description[$rule->getId()] = $label;
    }

    $address->setDiscountDescriptionArray($description);  

    return $return;
}`

Why not displaying the frontend labels instead?

Was this page helpful?
0 / 5 - 0 ratings