hook_commerce_checkout_complete is never called I need to send out a PDF via mail upon order completion, and according to DrupalContrib, I can use hook_commerce_checkout($order) to achieve this.

this is my module code:

&lt;?php

function pdf_checkout_commerce_checkout_complete($order) {
  // No example.
  \Drupal::logger('pdf_checkout')-&gt;info('Hook called.');
}


My problem is, that it is never called, I've tried everything from just sending a log message when it is used, to creating a new, clean, module just to test it.
None of it has worked.

Is the hook still being used in Commerce 2.x? If not, what should I look at instead to achieve a similar effect?

Thanks in advance.
Is the hook still being used in Commerce 2.x?


No.


  If not, what should I look at instead to achieve a similar effect?


Commerce 8.x-2.x depends on the state_machine module which has events that are triggered when an order is placed (=checkout complete) as well as other state changes.

See Assigning (adding) an entity reference when an Order process is completed