September 14, 2022
By default Shopify points to the /accounts page when Customers login. This function will redirect them to a page of your choice.
Place in theme.liquid before </body>
<script>
(function() {
var REDIRECT_PATH = '/checkout'; // change to desired page
var selector = '#form_ID, form[action$="/account"][method="post"]', // change #form_ID to the login form ID, and update /account to match your form
$form = document.querySelectorAll(selector)[0];
if ($form) {
$redirect = document.createElement('input');
$redirect.setAttribute('name', 'return_to');
$redirect.setAttribute('type', 'hidden');
$redirect.value = REDIRECT_PATH;
$form.appendChild($redirect);
}
})();
</script>
Source (with video and more details).