Skip to content

[GraphQl] Bundle Product with fixed price, bundle option products prices are not scoped #39149

Open
@KamilGromekSpyrosoft

Description

@KamilGromekSpyrosoft

Preconditions and environment

  • Magento 2.4.7-p2
  • Multistore (multiple websites with different currencies)
  • Price attribute set to 'website' scope

Steps to reproduce

Steps with example screenshots:

  1. Switch to ALL STORE VIEWS
  2. Create new bundle product. Set 'dynamic price' to OFF (set price to fixed). Proceed with normal product creation (fill prices etc):
    obraz
  3. Add new bundle option. Fill required fields and set fixed price:
    obraz
  4. Switch scope to different website, edit product option and set different fixed price:
    obraz
  5. Check product data via GraphQl

Summary of my example:

ALL STORE VIEWS:
Product price: 1000
Product option price: 111

XXX STORE VIEW:
Product price: Inherit from ALL STORE VIEWS - 1000
Product option price: 333

GraphQL query used to test:

    products(filter: { sku: { eq: "test_bundle_product_sku" } }) {
        items {
            ... on BundleProduct{
                dynamic_price
                price_range {
                    minimum_price {
                        final_price {
                            value
                        }
                    }
                    maximum_price {
                        final_price {
                            value
                        }
                    }
                }
                price_details {
                    discount_percentage
                    main_final_price
                    main_price
                    __typename
                }
                items {
                    uid
                    required
                    title
                    options {
                        uid
                        is_default
                        price
                        price_type
                        quantity
                        __typename
                    }
                    __typename
                }
            }
            __typename
        }
        __typename
    }
}

Expected result

GraphQl query should provide correct prices for both product and its item options.

{
  "data": {
    "products": {
      "items": [
        {
          "dynamic_price": false,
          "price_range": {
            "minimum_price": {
              "final_price": {
                "value": 1333
              }
            },
            "maximum_price": {
              "final_price": {
                "value": 1333
              }
            }
          },
          "price_details": {
            "discount_percentage": 0,
            "main_final_price": 1000,
            "main_price": 1000,
            "__typename": "PriceDetails"
          },
          "items": [
            {
              "uid": "YnVuZGxlLzQ=",
              "required": true,
              "title": "bbb",
              "options": [
                {
                  "uid": "YnVuZGxlLzQvNC8x",
                  "is_default": false,
                  "price": 333,
                  "price_type": "FIXED",
                  "quantity": 1,
                  "__typename": "BundleItemOption"
                }
              ],
              "__typename": "BundleItem"
            }
          ],
          "__typename": "BundleProduct"
        }
      ],
      "__typename": "Products"
    }
  }
}

Actual result

Product price is calculated correctly (BASE 1000 + OPTION 333 = minimum and maximum final price is 1333)
Product item option price is incorrectly returned 111 instead of 333. This breaks all frontend calculations for this configuration

{
  "data": {
    "products": {
      "items": [
        {
          "dynamic_price": false,
          "price_range": {
            "minimum_price": {
              "final_price": {
                "value": 1333
              }
            },
            "maximum_price": {
              "final_price": {
                "value": 1333
              }
            }
          },
          "price_details": {
            "discount_percentage": 0,
            "main_final_price": 1000,
            "main_price": 1000,
            "__typename": "PriceDetails"
          },
          "items": [
            {
              "uid": "YnVuZGxlLzQ=",
              "required": true,
              "title": "bbb",
              "options": [
                {
                  "uid": "YnVuZGxlLzQvNC8x",
                  "is_default": false,
                  "price": 111,
                  "price_type": "FIXED",
                  "quantity": 1,
                  "__typename": "BundleItemOption"
                }
              ],
              "__typename": "BundleItem"
            }
          ],
          "__typename": "BundleProduct"
        }
      ],
      "__typename": "Products"
    }
  }
}

Additional information

This happens because implementation in \Magento\BundleGraphQl\Model\Resolver\Links\Collection::fetch. Link collection does not join "catalog_product_bundle_selection_price" table in any way, only providing base (all store views) data from "catalog_product_bundle_selection" table.

Release note

No response

Triage and priority

  • 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”.

Activity

m2-assistant

m2-assistant commented on Sep 9, 2024

@m2-assistant

Hi @KamilGromekSpyrosoft. 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:


Join Magento Community Engineering Slack and ask your questions in #github channel.
⚠️ 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, join the Community Contributions Triage session to discuss the appropriate ticket.

self-assigned this
on Sep 10, 2024
m2-assistant

m2-assistant commented on Sep 10, 2024

@m2-assistant

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).
    2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
    3. Add Area: XXXXX label to the ticket, indicating the functional areas 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

engcom-Bravo commented on Sep 10, 2024

@engcom-Bravo
Contributor

Hi @KamilGromekSpyrosoft,

Thanks for your reporting and collaboration.

We have verified the issue in Latest 2.4-develop instance and it seems to be an expected behaviour because we have set price to Website scope so it will retrieve website wise prices.

Screenshot 2024-09-10 at 11 30 50

Kindly let us know if we are missing anything and if you are still facing any issue.

Thanks.

moved this from Ready for Confirmation to Needs Update in Issue Confirmation and Triage Boardon Sep 10, 2024
KamilGromekSpyrosoft

KamilGromekSpyrosoft commented on Sep 10, 2024

@KamilGromekSpyrosoft
Author

Can You provide full graphql response of Your example?

Please check node data-> products -> items[0] -> items[0] -> options[0] -> price.
GraphQl returns correct bundle product price (and if You add the product to cart with options the cart item price is correct too), the issue is with option price which can be used to do frontend calculations.

Below is a screenshot of my bundle product options.
Left table - catalog_product_bundle_selection
Right Table - catalog_product_bundle_selection_price
obraz

Notice the difference in selection_price_value. When you query for product from website 1 (and if you have other websites as well), query does not return 333 price value but the default 111.

In summary, GraphQl data provider should correctly join catalog_product_bundle_selection_price table to provide scoped data (if it exists) like the rest of the system does.

KamilGromekSpyrosoft

KamilGromekSpyrosoft commented on Sep 10, 2024

@KamilGromekSpyrosoft
Author

@magento give me 2.4-develop instance

magento-deployment-service

magento-deployment-service commented on Sep 10, 2024

@magento-deployment-service

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

17 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: APIsComponent: ApiUse with concrete module component label E.g. "Component: Api" + "Catalog"Issue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P3May be fixed according to the position in the backlog.Progress: ready for devReported on 2.4.7-p2Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @engcom-Bravo@github-jira-sync-bot@KamilGromekSpyrosoft

        Issue actions

          [GraphQl] Bundle Product with fixed price, bundle option products prices are not scoped · Issue #39149 · magento/magento2