Shopify by default redirect customer on my-account page after login. But lets say some one searched on your site and find specific product now they want to login on your site . Then after login by-default he move to my-account page but you want move on same product page from where he try to login on your site.
Its can possible by following few step.
First you need to login on your admin side . Then need to edit some of liquid file. For this click on online store. see image bellow
Then click on Themes link. after click on theme link you need to click on three dots . see image bellow
Then click on Html/css link refer image bellow
A luanchpad has been open refer image bellow.
Now you need to find you customer login link liquid in both section asset asn snippets both . liquid file name is depend upon your theme. in my case its available in Snippets. Refer image bellow.
Now you need to add some java-script code in this liquid file
Now you ready to redirect user on visited page after login . 🙂