Skip to content

Adding variation from another configurable product to cart if variation belongs to same super attribute is possible #24676

Closed
@VitaliyBoyko

Description

@VitaliyBoyko

Preconditions (*)

  1. Magento 2.3 from the latest magento/graphql-ce/2.3-develop

Steps to reproduce (*)

  1. Create 2 Configurable products SKU's: [sku-c1, sku-c2]
  2. Add 1 super attribute option, etc. Color - Red
    image
  3. Create 1 variation with attribute Color -Red for each product SKU's:[sku-c1-Red, sku-c2-Red]
    image
    Don't forget fill out quantity and add all products to the category.

The result should look like:
image

  1. Create empty cart
  2. Run mutation with the wrong parent SKU.
mutation {
  addConfigurableProductsToCart(
    input:{
      cart_id:"NEW_CART_ID"
      cart_items:{
        parent_sku: "sku-c1"
        data:{
          sku:"sku-c2-Red"
          quantity:1
        }
      }
    }
  ) {
    cart {
      items {
        id
        quantity
        product {
          sku
        }
        ... on ConfigurableCartItem {
          configurable_options {
            id
            option_label
            value_id
            value_label
          }
        }
      }
    }
  }
}

Expected result (*)

  1. Error is thrown.

Actual result (*)

  1. sku-c1-Red being added to cart.
    image

I'm not sure whether it is bug or feature. Magento automatically selects the correct child product according to the super attribute. Consider this and unmark/fix the folowing test \Magento\GraphQl\ConfigurableProduct\AddConfigurableProductToCartTest::testAddVariationFromAnotherConfigurableProductWithTheSameSuperAttributeToCart added in PR magento/graphql-ce#866.

Metadata

Metadata

Labels

Component: ConfigurableProductGraphQlIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.3.xThe issue has been reproduced on latest 2.3 release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions