Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coupon with Fixed amount discount for whole cart apply rule not working in graphql #30719

Closed
5 tasks
rani-priya opened this issue Oct 30, 2020 · 33 comments
Closed
5 tasks
Assignees
Labels
Component: GraphQL GraphQL Issue: needs update Additional information is require, waiting for response Issue: ready for confirmation Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: done Project: GraphQL Reported on 2.4.0 Indicates original Magento version for the Issue report.

Comments

@rani-priya
Copy link
Contributor

rani-priya commented Oct 30, 2020

Preconditions (*)

  1. Magento version: 2.4
  2. php version : 7.3

Steps to reproduce (*)

  1. Go to magento backend

  2. create a cart price rule with this configuration(In Apply set "Fixed amount discount for whole cart")
    image

  3. Then apply the same coupon on cart in by using graphql

  4. In cart query check the grand total amount
    image
    image

Expected result (*)

  1. Discount should be deducted from the grand total in cart query graphql

Actual result (*)

  1. Discount is not deducting from the grand total in cart query graphql

Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • 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”.
@m2-assistant
Copy link

m2-assistant bot commented Oct 30, 2020

Hi @rani-webkul. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

Please, add a comment to assign the issue: @magento I am working on this


⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@bharat1811
Copy link

@magento I am working on this.

@m2-assistant
Copy link

m2-assistant bot commented Oct 31, 2020

Hi @bharat1811! 👋
Thank you for collaboration. Only members of Community Contributors Team are allowed to be assigned to the issue. Please use @magento add to contributors team command to join Contributors team.

@bharat1811
Copy link

@magento add to contributors team

@m2-assistant
Copy link

m2-assistant bot commented Oct 31, 2020

Hi @bharat1811! 👋
Thank you for joining. Please accept team invitation 👉 here 👈 and add your comment one more time.

@bharat1811
Copy link

bharat1811 commented Oct 31, 2020

@magento I am working on this.

@bharat1811
Copy link

@magento give me 2.4-develop instance

@magento-deployment-service
Copy link

Hi @bharat1811. Thank you for your request. I'm working on Magento instance for you.

@bharat1811
Copy link

bharat1811 commented Oct 31, 2020

@rani-webkul
The issue is not reproducible in the latest version.
#Issue: not reproducible

Steps to verify,

1. Get customer cart details,
{
customerCart {
id
items {
id
product {
name
sku
}
quantity
}
}
}

2. Apply created promo code,
mutation {
applyCouponToCart(
input: {
cart_id: "HvzaWRCngNlChASgYZkP6kF5SpeufPcv"
coupon_code: "FLAT10"
}
) {
cart {
applied_coupons {
code
}
}
}
}

3. Get cart details,
{
cart(cart_id: "HvzaWRCngNlChASgYZkP6kF5SpeufPcv") {
email
telephone
billing_address {
city
country {
code
label
}
firstname
lastname
postcode
region {
code
label
}
street
telephone
}
shipping_addresses {
firstname
lastname
street
city
region {
code
label
}
country {
code
label
}
available_shipping_methods {
amount {
currency
value
}
available
carrier_code
carrier_title
error_message
method_code
method_title
price_excl_tax {
value
currency
}
price_incl_tax {
value
currency
}
}
selected_shipping_method {
amount {
value
currency
}
carrier_code
carrier_title
method_code
method_title
}
}
items {
id
product {
name
sku
}
quantity
}
available_payment_methods {
code
title
}
selected_payment_method {
code
title
}
applied_coupons {
code
}
prices {
subtotal_including_tax{
value
currency
},
discount{
amount{
value
}
}
grand_total {
value
currency
}
}
}
}

@rani-priya
Copy link
Contributor Author

@magento give me 2.4-develop instance

@magento-deployment-service
Copy link

Hi @rani-webkul. Thank you for your request. I'm working on Magento instance for you.

@magento-deployment-service
Copy link

@rani-priya
Copy link
Contributor Author

@bharat1811 it's still reproduceable on upper instance as well.
Please use below cart query and then check
{
cart(cart_id: "l2X1hXV1PBgtdtMZMTseGWsVQzEcVpAi") {
email
billing_address {
city
country {
code
label
}
firstname
lastname
postcode
region {
code
label
region_id
}
street
telephone
}
shipping_addresses {
firstname
lastname
street
city
region {
code
label
region_id
}
country {
code
label
}
telephone
available_shipping_methods {
amount {
currency
value
}
available
carrier_code
carrier_title
error_message
method_code
method_title
price_excl_tax {
value
currency
}
price_incl_tax {
value
currency
}
}
selected_shipping_method {
amount {
value
currency
}
carrier_code
carrier_title
method_code
method_title
}
}
items {
id
prices {
row_total{
value
}
row_total_including_tax
{
value
}
total_item_discount {
value
}
price {
value
}
discounts {
label
amount {
value
}
}
}
... on SimpleCartItem {
customizable_options {
label
values {
value
}
}
}
... on ConfigurableCartItem {
configurable_options {
id
option_label
value_id
value_label
}
}
... on BundleCartItem {
bundle_options {
id
label
type
values {
id
label
price
quantity
}
}
}
product {
name
sku
stock_status
price_range{
minimum_price{
regular_price{
value
currency
}
}
maximum_price{
regular_price{
value
currency
}
}
}
image {
url
label
}
... on BundleProduct {
dynamic_sku
dynamic_price
items {
option_id
title
required
type
position
sku
options {
id
quantity
position
is_default
price
label
product {
id
name
sku
image {
url
label
}
__typename
}
}
}
}
... on CustomizableProductInterface {
options {
title
required
sort_order
option_id
__typename
... on CustomizableDropDownOption {
title
value {
price_type
option_type_id
title
price
sku
}
}
}
}
... on ConfigurableProduct {
configurable_options {
id
label
position
use_default
attribute_id
attribute_code
values {
value_index
label
}
product_id
}
variants {
product {
id
name
sku
stock_status
attribute_set_id
... on PhysicalProductInterface {
weight
}
price_range{
minimum_price{
regular_price{
value
currency
}
}
}
}
attributes {
label
code
value_index
}
}
}
crosssell_products {
name
sku
price_range {
minimum_price {
regular_price {
value
currency
}
final_price {
value
currency
}
discount {
amount_off
percent_off
}
}
maximum_price {
regular_price {
value
currency
}
final_price {
value
currency
}
discount {
amount_off
percent_off
}
}
}
image {
url
label
}
}
}
quantity
}
available_payment_methods {
code
title
}
selected_payment_method {
code
title
}
applied_coupons {
code
}
prices {
discounts {
amount {
value
}
label
}
grand_total{
value
currency
}
subtotal_including_tax{
value
currency
}
subtotal_excluding_tax{
value
currency
}
subtotal_with_discount_excluding_tax{
value
currency
}
applied_taxes{
amount {
value
currency
}
label
}
}
}
}

image
image

@rani-priya
Copy link
Contributor Author

@magento give me 2.4-develop instance

@magento-deployment-service
Copy link

Hi @rani-webkul. Thank you for your request. I'm working on Magento instance for you.

@magento-deployment-service
Copy link

@sdzhepa sdzhepa added the Reported on 2.4.x Indicates original Magento version for the Issue report. label Nov 11, 2020
@magento-engcom-team magento-engcom-team added Reported on 2.4.0 Indicates original Magento version for the Issue report. and removed Reported on 2.4.x Indicates original Magento version for the Issue report. labels Nov 13, 2020
@sathiyaaa
Copy link

@magento I am working on this

@sathiyaaa
Copy link

@magento give me 2.4-develop instance

@magento-deployment-service
Copy link

Hi @sathiyaaa. Thank you for your request. I'm working on Magento instance for you.

@atishgoswami
Copy link
Contributor

Thanks @rani-webkul for reporting this issue, I was also facing the same issue

This is the patch for the issue if anyone else might be looking for it 😄
https://github.com/magento/quality-patches/blob/master/patches/os/MDVA-31363__fixes_cart_price_rule_coupon_does_not_apply_via_graphQl__2.4.0.patch

@mariuscris
Copy link

mariuscris commented Feb 14, 2021

Thank you @atishgoswami for the patch link. I have the same issue and I have tried to fix it with this patch:

--- a/vendor/magento/module-sales-rule/Model/Rule/Action/Discount/CartFixed.php
+++ b/vendor/magento/module-sales-rule/Model/Rule/Action/Discount/CartFixed.php
@@ -96,7 +96,7 @@
         if (!isset($cartRules[$rule->getId()])) {
             $cartRules[$rule->getId()] = $rule->getDiscountAmount();
         }
-        $availableDiscountAmount = (float) $cartRules[$rule->getId()];
+        $availableDiscountAmount = (float) $rule->getDiscountAmount();
         $discountType = self::$discountType . $rule->getId();

I believe the main problem is linked with \Magento\SalesRule\Model\Rule\Action\Discount\CartFixed and how the calculate method was build. The purpose of getCartFixedRules' on quote is very confusing for me. I see this data linked with multi-shipping and "allow shipping discount" option. In my case, I use discount for the whole cart without shipping and no multi-shipping.

The issue described in #31496 is most likely connected with this problem.
For the moment I will use both fixes, just in case the reset case is missing or forgotten.

@sivaschenko sivaschenko added the Priority: P2 A defect with this priority could have functionality issues which are not to expectations. label Mar 9, 2021
@pykettk
Copy link
Member

pykettk commented Mar 10, 2021

+1 for the solution from @mariuscris - worked for me! 😃

@JKair
Copy link

JKair commented Jul 12, 2021

I meet this bug too.

@riconeitzel
Copy link
Contributor

Confirmed that #30719 (comment) fixes the problem for us on 2.3.7-p2 in the regular checkout.

@mariuscris you have a typo in your comment ";;"

@mariuscris
Copy link

Thanks @riconeitzel for spotting the typo. It should be corrected by now

@ithunter0428
Copy link

Hi, I have an issue with cart Cart Price Rules.
If I make a new rule, it only apply to last product in cart.
Can anyone explain about it?

@engcom-Bravo engcom-Bravo self-assigned this Sep 6, 2022
@m2-assistant
Copy link

m2-assistant bot commented Sep 6, 2022

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: 👇

  • 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.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced 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!

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

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

@m2-assistant
Copy link

m2-assistant bot commented Sep 6, 2022

Hi @engcom-November. 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: 👇

  • 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.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced 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!

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

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

@engcom-November
Copy link
Contributor

Hi @rani-priya Verified the issue on Magento 2.4-develop instance with query mentioned in comment and as per devdocs as well but the issue is not reproducible. Grand total is displayed after discount. Kindly recheck the issue on Magento 2.4-develop branch and provide missing steps if any if the issue is still reproducible.
image

image

@engcom-November engcom-November added the Issue: needs update Additional information is require, waiting for response label Sep 7, 2022
@engcom-November
Copy link
Contributor

Hi @rani-priya ,
We are closing this issue as there has been no latest update on the same. Kindly reopen / create new issue if you are still facing any issues.
Thank you.

@engcom-Alfa
Copy link
Contributor

Hey all

as per discussion with the internal team confirming the ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: GraphQL GraphQL Issue: needs update Additional information is require, waiting for response Issue: ready for confirmation Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: done Project: GraphQL Reported on 2.4.0 Indicates original Magento version for the Issue report.
Projects
Archived in project
Development

No branches or pull requests