magento2
magento2 copied to clipboard
Coupon code feature is not working properly in the checkout page on Magento 2.4.7
Preconditions and environment
- Magento version: 2.4.7
- The checkout page only contains "Review & Payments" step as the cart only contains virtual or/and downloadable product types.
Steps to reproduce
Example:
- Create a Virtual/Downloadable product.
- Navigate to storefront as a guest.
- Click “Add to Cart” on the Virtual/Downloadable Product.
- Open mini shopping cart and click “Proceed to Checkout”.
- Click "Apply Discount Code" text to expand the coupon code form.
Expected result
The discount code/coupon input can be filled in, and the button title text displays as "Apply Discount".
Actual result
The discount code/coupon input is disabled, and the button title text displays as "Cancel coupon".
Additional information
It's important to note that I've tested this issue on Magento 2.4.6 and it didn't occurs.
Release note
No response
Triage and priority
- [ ] Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- [X] Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- [ ] Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- [ ] Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- [ ] Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Hi @TuVanDev. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:
@magento give me 2.4-develop instance- upcoming 2.4.x release- For more details, review the Magento Contributor Assistant documentation.
- Add a comment to assign the issue:
@magento I am working on this - To learn more about issue processing workflow, refer to the Code Contributions.
Join Magento Community Engineering Slack and ask your questions in #github channel. :warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting. :clock10: You can find the schedule on the Magento Community Calendar page. :telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.
@magento give me 2.4-develop instance
Hi @TuVanDev. Thank you for your request. I'm working on Magento instance for you.
Hi @TuVanDev, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.
Hi @engcom-Dash. 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:
-
- Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
-
- Verify that issue has a meaningful description and provides enough information to reproduce the issue.
-
- Add
Area: XXXXXlabel to the ticket, indicating the functional areas it may be related to.
- Add
-
- Verify that the issue is reproducible on
2.4-developbranchDetails
- Add the comment@magento give me 2.4-develop instanceto deploy test instance on Magento infrastructure.
- If the issue is reproducible on2.4-developbranch, please, add the labelReproduced on 2.4.x.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
- Verify that the issue is reproducible on
- Join Magento Community Engineering Slack and ask your questions in #github channel.
Hi @TuVanDev the file attached is a patch file that seems to resolve the issue. I have looked at Magento develop branch and previous Magento versions and this file has not changed in a while. That means this may not address the root of the issue. However, the patch change is low risk and I hope it may be sufficient to get this problem addressed discount-issue.zip
Hey @digitalrisedorset, thanks for your assist.
Yep, the code isApplied(couponCode() != null); in the file vendor/magento/module-sales-rule/view/frontend/web/js/view/payment/discount.js hasn't changes for years. It now has an empty value instead of null. Therefore, isApplied(couponCode() != null); should be changed to isApplied(couponCode() !== '');
I'll try to find the root cause and confirm if this is the best solution for this issue.
FYI, you can post the patch in your comment instead of sharing a zip file for more visibility.
the patch file code is:
`diff --git a/vendor/magento/module-sales-rule/view/frontend/web/js/view/payment/discount.js b/vendor/magento/module-sales-rule/view/frontend/web/js/view/payment/discount.js index 79e4085..ad3c109 100644 --- a/vendor/magento/module-sales-rule/view/frontend/web/js/view/payment/discount.js +++ b/vendor/magento/module-sales-rule/view/frontend/web/js/view/payment/discount.js @@ -21,7 +21,7 @@ define([ if (totals()) { couponCode(totals()['coupon_code']); }
- isApplied(couponCode() != null);
-
isApplied(couponCode() != '');
return Component.extend({ defaults: {`
@digitalrisedorset GitHub supports Markdown, so you can use triple backticks. You can check it out at https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax
diff --git a/vendor/magento/module-sales-rule/view/frontend/web/js/view/payment/discount.js b/vendor/magento/module-sales-rule/view/frontend/web/js/view/payment/discount.js
index 79e4085..ad3c109 100644
--- a/vendor/magento/module-sales-rule/view/frontend/web/js/view/payment/discount.js
+++ b/vendor/magento/module-sales-rule/view/frontend/web/js/view/payment/discount.js
@@ -21,7 +21,7 @@ define([
if (totals()) {
couponCode(totals()['coupon_code']);
}
- isApplied(couponCode() != null);
+ isApplied(couponCode() !== '');
return Component.extend({
defaults: {
However, this will break the feature if the cart contains an item that is not virtual. Therefore, I've investigated and found the root cause of the issue. I'll create a pull request soon!
@magento I am working on this
@magento give me 2.4-develop instance
Hi @engcom-Dash. Thank you for your request. I'm working on Magento instance for you.
Hi @engcom-Dash, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.
Hi @TuVanDev
Thanks for reporting and collaboration.
Verified the issue Magento 2.4 dev instance and the issue is reproducible.
The coupon code feature is not working properly on the checkout page
Steps to reproduce:
- Create a Virtual/Downloadable product.
- Navigate to storefront as a guest.
- Click “Add to Cart” on the Virtual/Downloadable Product.
- Open mini shopping cart and click “Proceed to Checkout”.
- Click "Apply Discount Code" text to expand the coupon code form.
Please refer the screenshots.
:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-12170 is successfully created for this GitHub issue.
:white_check_mark: Confirmed by @engcom-Dash. Thank you for verifying the issue.
Issue Available: @engcom-Dash, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.
@magento give me 2.4-develop instance
Hi @slavvka. Thank you for your request. I'm working on Magento instance for you.
Hi @slavvka, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.
@magento give me 2.4-develop instance
Hi @slavvka. Thank you for your request. I'm working on Magento instance for you.
Hi @slavvka, here is your Magento Instance: https://9ceeb01fdafc117bec5bf7142b7b61a8.instances-prod.magento-community.engineering Admin access: https://9ceeb01fdafc117bec5bf7142b7b61a8.instances-prod.magento-community.engineering/admin_82b0 Login: 6463eb33 Password: 3b63bd84622c
Hi @TuVanDev,
Internal team has started to work on it”
Thanks.
Probably fixed by AC:12170 :: Coupon code feature is not working properly in the checkout page on Magento 2.4.7?
@hostep Thanks for your contribution!!.
Hello,
As I can see this issue got fixed in the scope of the internal Jira ticket AC-12710 by the internal team Related commits: https://github.com/search?q=repo%3Amagento%2Fmagento2+AC+12170&type=commits
Based on the Jira ticket, the target version is 2.4.8-beta1.
Thanks
The link provided above doesn't work, but this one does: https://github.com/search?q=repo%3Amagento%2Fmagento2+AC+12170&type=commits