Skip to content

Integrity constraint violation error after reordering product with custom options #12705

@alena-marchenko

Description

@alena-marchenko

Preconditions

  1. Magento with Sample Data is installed from 2.2-develop branch

Steps to reproduce

  1. Go to Admin > Products > Catalog
  2. Click Add product button
  3. Fill in information for the item
  • Product name = testprod
  • Sku = testprod
  • Add product to any category
  • At the Configurations section click Edit Configurations button
    -- Select color and size from the list and click Next
    -- Select Colors Black and Blue from the Color Section, and Size S, M, L from the Size section and click Next
    -- At the next screen enter the following configuration:
    --- Images: Skip image uploading at this time
    --- Price: Apply single price to all SKUs = 100
    --- Quantity: Apply single quantity to each Skus = 10
  • At the Customizable Options click on Add Option button
    -- Option 1
    --- Option title: opt1
    --- Option type: radio button
    --- Required: leave it empty
    --- Title: option 1
    --- Price 10.00
    --- Price type: fixed
    --- Sku: 22
    -- Option 2
    --- Option title: opt2
    --- Option type: radio button
    --- Title: option 2
    --- Price 15.00
    --- Price type: fixed
    --- Sku: 21
  • Click Save to save the item.
  1. Go to the Storefront and find the item testprod
  2. Add the first item to the cart by choosing the following configuration:
    • Color: Black
    • Size: S
    • Opt1: option1 + $10.00
    • Opt2: None
    • Qty: 1
  3. Add the second item to the cart by choosing the following configuration:
    Color: Black
    Size: S
    Opt1: None
    Opt2: option2 + $15.00
    Qty: 1
  4. Go to Admin and find your recent order in Sales > Orders
  5. Click on the view link and once the order loads click Reorder button

Expected result

New order page is opened

Actual result

Unable to reorder, error is thrown and logged in var/report

Log from var/report:
[a:4:{i:0;s:386:"SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (dbname.quote_item_option, CONSTRAINT QUOTE_ITEM_OPTION_ITEM_ID_QUOTE_ITEM_ITEM_ID FOREIGN KEY (item_id) REFERENCES quote_item (item_id) ON DELETE CASCADE), query was: INSERT INTO quote_item_option (product_id, code, value) VALUES (?, ?, ?)";i:1;s:13245:"#0 /pathToMagentoFolder/vendor/magento/framework/DB/Statement/Pdo/Mysql.php(95): Zend_Db_Statement_Pdo->_execute(Array)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: CatalogComponent: SalesFixed in 2.2.xThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releasebug report

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions