Commerce

Load Order and change it status to "Cancelled":

$order = \Drupal::entityTypeManager()
->getStorage('commerce_order')
 ->load(1);
$order->getState()->applyTransitionById('cancel');
$order->save();