0

I have already an event subscriber class with commerce_order.place.post_transition defined. I need to remove nodes when an order is deleted or canceled.

What event could I use in that case?

2
$events = [
  // State change events fired on workflow transitions from state_machine.
  'commerce_order.place.post_transition' => ['onOrderPlace', -100],
  'commerce_order.cancel.post_transition' => ['onOrderCancel', -100],
  // Order storage events dispatched during entity operations in CommerceContentEntityStorage.
  // ORDER_UPDATE handles new order items since ORDER_ITEM_INSERT doesn't.
  'commerce_order.commerce_order.update' => ['onOrderUpdate', -100],
  'commerce_order.commerce_order.predelete' => ['onOrderDelete', -100],
  /* OrderEvents::ORDER_ITEM_UPDATE => ['onOrderItemUpdate', -100],
  OrderEvents::ORDER_ITEM_DELETE => ['onOrderItemDelete', -100], */

  'commerce_payment.filter_payment_gateways' => ['onPayment', -100],
  ];
return $events;
}
0

You can use $events['commerce_order.cancel.post_transition'] for subscribing to order cancel event.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.