Like the title says, node does get deleted like it should but in cart it stays as "content type".

For example, node named "Welcome" is created of content type "Article".
If it was not published (payed) and deleted by admin or user, it stays in the users cart named "Article"

Comments

BigBrother2010 created an issue.

TolstoyDotCom’s picture

This seems to work after one test, but there might be side-effects or another way to do it:

function commerce_node_checkout_commerce_cart_order_refresh( $order_wrapper ) {
  foreach ($order_wrapper->commerce_line_items as $delta => $line_item_wrapper) {
    // If this line item is a node checkout but the node doesn't exist anymore,
    // delete the line item.
    $product = $line_item_wrapper->commerce_product->value();
    if ($product->type == 'commerce_node_checkout' && !$line_item_wrapper->commerce_node_checkout_node->value()) {
      unset($order_wrapper->commerce_line_items[$delta]);
    }
  }
}