Redirect to checkout after pressing the "Add to Cart" button
you could do something like this:

use Drupal\Core\Form\FormStateInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;

function MYMODULE_form_alter(&amp;$form, FormStateInterface $form_state, $form_id) {
  if (strpos($form_id, 'commerce_order_item_add_to_cart_form_commerce_product') !== false) {
    $form['actions']['submit']['#submit'][] = 'MYMODULE_cart_alter_sub';
 }
}
function MYMODULE_cart_alter_sub(&amp;$form, FormStateInterface $form_state) {
  $responce =  new RedirectResponse('/cart');
  $responce-&gt;send();
}