Order Items IEF default settings can cause orphaned items

Created on 29 March 2023, over 1 year ago
Updated 30 March 2023, over 1 year ago

Describe your bug or feature request.

Inline Entity Form pushed an update that allows you to configure the following behavior for when a reference is deleted:

https://www.drupal.org/project/inline_entity_form/issues/2875716 Widget settings to control removing & deleting existing references Fixed

  • Allow the user to decide if the referenced entity is deleted
  • Always delete the referenced entity
  • Never delete the referenced entity

After installing this update on my site, the default setting for order items was to Allow the user to decide. This is problematic for orders being managed in the admin area. If an admin deletes an order item and doesn't check the checkbox to remove the order item from the system, you are left with an orphaned order item. There are modules that depend on the order item deletion to occur to do things such as make a stock transaction. Those events never fire if the reference is removed without deleting the entity.

If a bug, provide steps to reproduce it from a clean install.

  • Create an order with order items and save it.
  • Edit the order.
  • Click the button to Remove an order item.
  • Leave the "delete this entity from the system" checkbox unchecked.
  • Save the order.
  • Check your DB, the order item still exists and there is no way to delete it other than drush / command line

Proposed fix

Set the order item widget setting for all order types to Always delete the referenced entity.

🐛 Bug report
Status

Fixed

Version

2.0

Component

User experience

Created by

🇺🇸United States ericchew

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024