Open DuckThom opened 1 year ago
Hi @DuckThom. 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@magento I am working on this
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.
Hi @engcom-Bravo. 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:
Area: XXXXX
label to the ticket, indicating the functional areas it may be related to.2.4-develop
branch@magento give me 2.4-develop instance
to deploy test instance on Magento infrastructure. 2.4-develop
branch, please, add the label Reproduced on 2.4.x
.Issue: Confirmed
once verification is complete. @magento give me 2.4-develop instance
Hi @engcom-Bravo. Thank you for your request. I'm working on Magento instance for you.
Hi @engcom-Bravo, here is your Magento Instance: https://7108b5f85a79b56ea3e7305a62bfbf5f.instances-prod.magento-community.engineering Admin access: https://7108b5f85a79b56ea3e7305a62bfbf5f.instances-prod.magento-community.engineering/admin_2634 Login: 7e2978d8 Password: 17963ab68801
Hi @DuckThom,
Thank you for reporting and collaboration.
Verified the issue on Magento 2.4-develop instance and the issue is not reproducible.Kindly refer the screenshots.
Steps to reproduce
query cart($cartId: String!) {
cart(cart_id: $cartId) {
is_virtual
prices {
discounts {
amount {
value
currency
}
label
}
}
applied_coupons {
code
}
}
}
As per this document https://developer.adobe.com/commerce/webapi/graphql/schema/cart/queries/cart/#cartprices-object we will get the discounts under discounts object.Please refer the document and let us know if you are still facing any issue.
Thanks.
Hello @engcom-Bravo
I am able to reproduce this on the 2.4-develop branch.
I've created a clean Magento 2 installation, with 1 virtual product and 1 cart price rule (20% discount) with a coupon code "TEST-123"
After which I've executed the following GraphQL mutations:
As you can see in the final screenshot, the coupon code is applied, but the cart.prices.discounts
field is empty
Additionally, here is a screenshot of the cart query of the current situation:
As you can see, the 20% discount itself is applied (grand total is 10 EUR lower than the subtotal). But there is no active discount listed in the response.
Here is a screenshot of the response (query is the same as above) where I applied the potential fix I mentioned in my original comment:
Here, the applied discount amount of 20% / 10 EUR is correctly visible in the response.
Hi @DuckThom,
Thanks for your quick response.
Verified the issue on Magento 2.4-develop instance and the issue is reproducible. Kindly refer the screenshots.
Steps to reproduce
query cart($cartId: String!) {
cart(cart_id: $cartId) {
is_virtual
prices {
discounts {
amount {
value
currency
}
label
}
}
applied_coupons {
code
}
}
}
Coupon is getting applied but in the discounts field we are getting as NULL.
Hence Confirming this issue.
Thanks.
:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-9169 is successfully created for this GitHub issue.
:white_check_mark: Confirmed by @engcom-Bravo. Thank you for verifying the issue.
Issue Available: @engcom-Bravo, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.
any update?
Preconditions and environment
is_virtual
is true)Steps to reproduce
Expected result
Coupon is applied to the cart and the applied discount is visible in the
cart.prices.discounts
array.Actual result
Coupon code is applied and the discount is subtracted from the order total, however, the
cart.prices.discounts
field isnull
Additional information
https://github.com/magento/magento2/blob/ca30c47787db932b9431e42226bb918e95c932d9/app/code/Magento/QuoteGraphQl/Model/Resolver/Discounts.php#L45
The Discounts resolver attempts to read the discounts from the cart shipping address. Since it's a virtual cart, there is no shipping address and therefor no discounts will be returned.
Potential fix Changing the line to
$address = $quote->getBillingAddress();
will return the discounts as expected. But I am not sure if this will be 100% reliable.Release note
No response
Triage and priority