Cart is not updated when Product is deleted or unpublished

Created on 14 March 2017, almost 8 years ago
Updated 30 August 2024, 4 months ago

Problem/Motivation

When a purcheasable entity is deleted, carts with this product in are not updated.

Problem/Motivation

Using Drupal 8 and Commerce 2.x latest dev as of today:
- As an admin: Create a product
- As an anonymous, open your cart: you get the empty cart message
- Add the product to your cart
- Checkout your cart: one product inside
- As an admin: Delete the product
- As an anonymous, open your cart: one product (with no more title) is still in your cart
- Checkout you cart: you will pay and be charged for a no more existing product

Proposed resolution

Check when cart is loaded that order item's purchasable entity still exists. If not, delete the corresponding order item.

NOTE: If someone can confirm the strategy, I am ok to try a patch for this.

🐛 Bug report
Status

Needs work

Version

2.0

Component

Cart

Created by

🇫🇷France Dom.

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024