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

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

    Issue actions