Skip to content

GraphQL - price_range for configurable products is affected by disabled variants #33629

Closed
@aligent-lturner

Description

@aligent-lturner

Preconditions (*)

  1. Magento 2.4.x (reproduced on latest dev at time of writing)

Steps to reproduce (*)

  1. Create a configurable product with a sku "test-config-1" with a single configurable attribute (e.g. size) and at least 2 options (e.g. S, M, L)
  2. Set the price of one variant to be $40, and the others to be $50
  3. Disable the variant with the lower price
  4. Execute the following query:
query {
  products(
    filter: {
      sku: {
        eq: "test-config-1"
      }
    }
  ) {
    items {
      sku
      price_range {
        minimum_price {
          discount {
            amount_off
            percent_off
          }
          final_price {
            value
            currency
          }
          regular_price {
            value
            currency
          }
        }
      }
      ...on ConfigurableProduct {
        configurable_options {
          values {
            label
          }
        }
        variants {
          attributes {
            label
          }
          product {
            sku
          }
        }
      }
    }
  }
}

Expected result (*)

  1. price_range values are unaffected by disabled variants:
{
  "data": {
    "products": {
      "items": [
        {
          "sku": "test-config-1",
          "price_range": {
            "minimum_price": {
              "discount": {
                "amount_off": 0,
                "percent_off": 0
              },
              "final_price": {
                "value": 50,
                "currency": "USD"
              },
              "regular_price": {
                "value": 50,
                "currency": "USD"
              }
            }
          },
          "configurable_options": [
            {
              "values": [
                {
                  "label": "S"
                },
                {
                  "label": "M"
                },
                {
                  "label": "L"
                }
              ]
            }
          ],
          "variants": [
            {
              "attributes": [
                {
                  "label": "L"
                }
              ],
              "product": {
                "sku": "test-config-1-L"
              }
            },
            {
              "attributes": [
                {
                  "label": "M"
                }
              ],
              "product": {
                "sku": "test-config-1-M"
              }
            }
          ]
        }
      ]
    }
  }
}

Actual result (*)

  1. Price of disabled sku affects price_range values of configurable:
{
  "data": {
    "products": {
      "items": [
        {
          "sku": "test-config-1",
          "price_range": {
            "minimum_price": {
              "discount": {
                "amount_off": 10,
                "percent_off": 20
              },
              "final_price": {
                "value": 40,
                "currency": "USD"
              },
              "regular_price": {
                "value": 50,
                "currency": "USD"
              }
            }
          },
          "configurable_options": [
            {
              "values": [
                {
                  "label": "S"
                },
                {
                  "label": "M"
                },
                {
                  "label": "L"
                }
              ]
            }
          ],
          "variants": [
            {
              "attributes": [
                {
                  "label": "L"
                }
              ],
              "product": {
                "sku": "test-config-1-L"
              }
            },
            {
              "attributes": [
                {
                  "label": "M"
                }
              ],
              "product": {
                "sku": "test-config-1-M"
              }
            }
          ]
        }
      ]
    }
  }
}

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

I consider this to be critical data, as incorrect pricing is provided to the customer. A work-around would be to change the price of the disabled product, but this is not a good solution.

Note - the variants field being returned does not show the disabled product, so I believe the solution would involve applying the same logic used by its collection to the collection used for calculating pricing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: APIsComponent: CatalogGraphQlIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P1Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing.Progress: doneProject: GraphQLReproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchSeverity: S1Affects critical data or functionality and forces users to employ a workaround.

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions