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

Graphql price tiers returning data from previous item in foreach #32279

Closed
3 tasks
treestonemedia opened this issue Feb 24, 2021 · 10 comments · Fixed by #32353
Closed
3 tasks

Graphql price tiers returning data from previous item in foreach #32279

treestonemedia opened this issue Feb 24, 2021 · 10 comments · Fixed by #32353
Assignees
Labels
Component: GraphQL GraphQL Component: Pricing Event: Adobe Summit Hackathon Fixed in 2.4.x The issue has been fixed in 2.4-develop branch Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: ready for confirmation Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Progress: done Project: GraphQL Reported on 2.4.2 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Severity: S1 Affects critical data or functionality and forces users to employ a workaround.

Comments

@treestonemedia
Copy link

treestonemedia commented Feb 24, 2021

Preconditions

  1. Clean Magento 2.4.2 with sample data
  2. 2.4-develop

Steps to reproduce (*)

  1. Install clean Magento 2.4.2 with sample data
  2. Add tier pricing to any item (for this example we added tier prices to items ID 1 & 2)
  3. run Graphql query with search that will include the item with tier prices and items without tier prices
{
  products(pageSize: 20, currentPage: 1, search: "24-MB0") {
    items {
      id
      price_tiers {
        quantity
        final_price {
          value
        }
      }
    }
  }
}
{code}

### Expected result (*)

1. Items with tier price return correct tier pricing, items without tier pricing return no tier prices
{code}
{{
{
    "data": {
        "products": {
            "items": <
                {
                    "id": 42,
                    "price_tiers": []
                },
				...
                {
                    "id": 17,
                    "price_tiers": []
                },
                {
                    "id": 1,
                    "price_tiers": [
                        {
                            "quantity": 1,
                            "final_price": {
                                "value": 34
                            }
                        },
                        {
                            "quantity": 5,
                            "final_price": {
                                "value": 32
                            }
                        }
                    ]
                },
                {
                    "id": 23,
                    "price_tiers": []
                },
                {
                    "id": 19,
                    "price_tiers": []
                },
				...
            ]
        }
    }
}
}}
{code}

### Actual result (*)

1. All items coming after an item with tier pricing have tier pricing in the response
1. The tier pricing data that it's returning is from the last item in the loop that had tier pricing
1. in our example, items ID 1 & ID 2 are the only ones that have tier pricing, yet here is the result

{code}
{
    "data": {
        "products": {
            "items": [
                {
                    "id": 42,
                    "price_tiers": []
                },
                {
                    "id": 2046,
                    "price_tiers": []
                },
                {
                    "id": 11,
                    "price_tiers": []
                },
                {
                    "id": 12,
                    "price_tiers": []
                },
                {
                    "id": 6,
                    "price_tiers": []
                },
                {
                    "id": 3,
                    "price_tiers": []
                },
                {
                    "id": 41,
                    "price_tiers": []
                },
                {
                    "id": 18,
                    "price_tiers": []
                },
                {
                    "id": 39,
                    "price_tiers": []
                },
                {
                    "id": 17,
                    "price_tiers": []
                },
                {
                    "id": 1,
                    "price_tiers": [
                        {
                            "quantity": 1,
                            "final_price": {
                                "value": 34
                            }
                        },
                        {
                            "quantity": 5,
                            "final_price": {
                                "value": 32
                            }
                        }
                    ]
                },
                {
                    "id": 23,
                    "price_tiers": [
                        {
                            "quantity": 1,
                            "final_price": {
                                "value": 34
                            }
                        },
                        {
                            "quantity": 5,
                            "final_price": {
                                "value": 32
                            }
                        }
                    ]
                },
                {
                    "id": 19,
                    "price_tiers": [
                        {
                            "quantity": 1,
                            "final_price": {
                                "value": 34
                            }
                        },
                        {
                            "quantity": 5,
                            "final_price": {
                                "value": 32
                            }
                        }
                    ]
                },
                {
                    "id": 8,
                    "price_tiers": [
                        {
                            "quantity": 1,
                            "final_price": {
                                "value": 34
                            }
                        },
                        {
                            "quantity": 5,
                            "final_price": {
                                "value": 32
                            }
                        }
                    ]
                },
                {
                    "id": 13,
                    "price_tiers": [
                        {
                            "quantity": 1,
                            "final_price": {
                                "value": 34
                            }
                        },
                        {
                            "quantity": 5,
                            "final_price": {
                                "value": 32
                            }
                        }
                    ]
                },
                {
                    "id": 15,
                    "price_tiers": [
                        {
                            "quantity": 1,
                            "final_price": {
                                "value": 34
                            }
                        },
                        {
                            "quantity": 5,
                            "final_price": {
                                "value": 32
                            }
                        }
                    ]
                },
                {
                    "id": 16,
                    "price_tiers": [
                        {
                            "quantity": 1,
                            "final_price": {
                                "value": 34
                            }
                        },
                        {
                            "quantity": 5,
                            "final_price": {
                                "value": 32
                            }
                        }
                    ]
                },
                {
                    "id": 22,
                    "price_tiers": [
                        {
                            "quantity": 1,
                            "final_price": {
                                "value": 34
                            }
                        },
                        {
                            "quantity": 5,
                            "final_price": {
                                "value": 32
                            }
                        }
                    ]
                },
                {
                    "id": 43,
                    "price_tiers": [
                        {
                            "quantity": 1,
                            "final_price": {
                                "value": 34
                            }
                        },
                        {
                            "quantity": 5,
                            "final_price": {
                                "value": 32
                            }
                        }
                    ]
                },
                {
                    "id": 44,
                    "price_tiers": [
                        {
                            "quantity": 1,
                            "final_price": {
                                "value": 34
                            }
                        },
                        {
                            "quantity": 5,
                            "final_price": {
                                "value": 32
                            }
                        }
                    ]
                }
            >
        }
    }
}
  1. The issue started happening since commit b2021d5#diff-8d1c1372668a97ccd40b222f73acfe4c6b5ce24ad261215306610ae8817cdc65

cc: @Usik2203

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

  • <x] 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 Feb 24, 2021

Hi @treestonemedia. 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

@treestonemedia
Copy link
Author

@Usik2203 can you please take a look at this?

@engcom-Bravo engcom-Bravo self-assigned this Feb 26, 2021
@m2-assistant
Copy link

m2-assistant bot commented Feb 26, 2021

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.

@engcom-Bravo
Copy link
Contributor

Hello @treestonemedia

Thank you for your report.

We have reproduced the reported issue on the latest 2.4-develop.
After adding tier price to the products 24-MB01 and 24-MB04, the GraphQL search query returns tier prices for products that have not been changed.
Before adding tier price to products 24-MB01 and 24-MB04

{
  "data": {
    "products": {
      "items": [
        {
          "id": 43,
          "price_tiers": []
        },
        {
          "id": 2047,
          "price_tiers": []
        },
        {
          "id": 12,
          "price_tiers": []
        },
        {
          "id": 13,
          "price_tiers": []
        },
        {
          "id": 7,
          "price_tiers": []
        },
        {
          "id": 4,
          "price_tiers": []
        },
        {
          "id": 42,
          "price_tiers": []
        },
        {
          "id": 2,
          "price_tiers": []
        },
        {
          "id": 19,
          "price_tiers": []
        },
        {
          "id": 40,
          "price_tiers": []
        },
        {
          "id": 18,
          "price_tiers": []
        },
        {
          "id": 20,
          "price_tiers": []
        },
        {
          "id": 24,
          "price_tiers": []
        },
        {
          "id": 23,
          "price_tiers": []
        },
        {
          "id": 44,
          "price_tiers": []
        },
        {
          "id": 17,
          "price_tiers": []
        },
        {
          "id": 14,
          "price_tiers": []
        },
        {
          "id": 9,
          "price_tiers": []
        },
        {
          "id": 16,
          "price_tiers": []
        },
        {
          "id": 37,
          "price_tiers": []
        }
      ]
    }
  }
}

After adding tier price to products 24-MB01 and 24-MB04

{
  "data": {
    "products": {
      "items": [
        {
          "id": 43,
          "price_tiers": []
        },
        {
          "id": 2047,
          "price_tiers": []
        },
        {
          "id": 12,
          "price_tiers": []
        },
        {
          "id": 13,
          "price_tiers": []
        },
        {
          "id": 7,
          "price_tiers": []
        },
        {
          "id": 4,
          "price_tiers": []
        },
        {
          "id": 42,
          "price_tiers": []
        },
        {
          "id": 19,
          "price_tiers": []
        },
        {
          "id": 40,
          "price_tiers": []
        },
        {
          "id": 2,
          "price_tiers": [
            {
              "quantity": 2,
              "final_price": {
                "value": 10
              }
            }
          ]
        },
        {
          "id": 18,
          "price_tiers": [
            {
              "quantity": 2,
              "final_price": {
                "value": 10
              }
            }
          ]
        },
        {
          "id": 20,
          "price_tiers": [
            {
              "quantity": 2,
              "final_price": {
                "value": 10
              }
            }
          ]
        },
        {
          "id": 24,
          "price_tiers": [
            {
              "quantity": 2,
              "final_price": {
                "value": 10
              }
            }
          ]
        },
        {
          "id": 23,
          "price_tiers": [
            {
              "quantity": 2,
              "final_price": {
                "value": 10
              }
            }
          ]
        },
        {
          "id": 44,
          "price_tiers": [
            {
              "quantity": 2,
              "final_price": {
                "value": 10
              }
            }
          ]
        },
        {
          "id": 17,
          "price_tiers": [
            {
              "quantity": 2,
              "final_price": {
                "value": 10
              }
            }
          ]
        },
        {
          "id": 14,
          "price_tiers": [
            {
              "quantity": 2,
              "final_price": {
                "value": 10
              }
            }
          ]
        },
        {
          "id": 9,
          "price_tiers": [
            {
              "quantity": 2,
              "final_price": {
                "value": 10
              }
            }
          ]
        },
        {
          "id": 16,
          "price_tiers": [
            {
              "quantity": 2,
              "final_price": {
                "value": 10
              }
            }
          ]
        },
        {
          "id": 37,
          "price_tiers": [
            {
              "quantity": 2,
              "final_price": {
                "value": 10
              }
            }
          ]
        }
      ]
    }
  }
}

@engcom-Bravo engcom-Bravo added Reported on 2.4.2 Indicates original Magento version for the Issue report. Severity: S1 Affects critical data or functionality and forces users to employ a workaround. Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. labels Feb 26, 2021
@m2-community-project m2-community-project bot added this to Dev In Progress in High Priority Backlog Feb 26, 2021
@m2-community-project m2-community-project bot removed this from Ready for Confirmation in Issue Confirmation and Triage Board Feb 26, 2021
@engcom-Bravo engcom-Bravo added Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch and removed Progress: dev in progress labels Feb 26, 2021
@m2-community-project m2-community-project bot moved this from Dev In Progress to Ready for Development in High Priority Backlog Feb 26, 2021
@engcom-Bravo engcom-Bravo added the Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed label Feb 26, 2021
@m2-community-project m2-community-project bot moved this from Ready for Development to Dev In Progress in High Priority Backlog Feb 26, 2021
@magento-engcom-team
Copy link
Contributor

✅ Confirmed by @engcom-Bravo
Thank you for verifying the issue. Based on the provided information internal tickets MC-41084 were created

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.

@Usik2203
Copy link
Contributor

@magento I am working on this

@m2-community-project m2-community-project bot moved this from Ready for Development to Dev In Progress in High Priority Backlog Feb 26, 2021
@m2-community-project m2-community-project bot added this to Dev In Progress in GraphQL Backlog Feb 26, 2021
@m2-community-project m2-community-project bot removed this from Dev In Progress in High Priority Backlog Feb 26, 2021
@SirCoolness
Copy link

@magento give me 2.4.2 instance

@magento-deployment-service
Copy link

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

@magento-deployment-service
Copy link

@gabrieldagama
Copy link
Contributor

@gabrieldagama gabrieldagama added the Fixed in 2.4.x The issue has been fixed in 2.4-develop branch label Apr 26, 2021
@m2-community-project m2-community-project bot moved this from Pull Request In Progress to Done in GraphQL Backlog Apr 26, 2021
@m2-community-project m2-community-project bot moved this from Done to Pull Request In Progress in GraphQL Backlog Apr 26, 2021
@m2-community-project m2-community-project bot moved this from Pull Request In Progress to Done in GraphQL Backlog Apr 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: GraphQL GraphQL Component: Pricing Event: Adobe Summit Hackathon Fixed in 2.4.x The issue has been fixed in 2.4-develop branch Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: ready for confirmation Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Progress: done Project: GraphQL Reported on 2.4.2 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Severity: S1 Affects critical data or functionality and forces users to employ a workaround.
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

8 participants