How Do I Autoplay an Embed YouTube Video in Shopify Homepage

Follow Below steps to embed a youtube video in your shopify store with autoplay, and loop.

  1. Go to customize
  2. Click on Add section
  3. Select Custom Liquid or Custom HTML
  4. Paste below code in the input box in the right sidebar.
  5. Replace the ID of your video which is just after embed/ and after playlist=
<style>
.youtube-container {
	overflow: hidden;
	width: 50%;
    margin: 0 auto;
	aspect-ratio: 16/9;
	pointer-events: none;
}
.youtube-container 	iframe {
    width: 300%;
    height: 100%;
    margin-left: -100%;
}
@media screen and (max-width: 800px) {
    .youtube-container {
	    width: 90%;
    }
}
</style>
<div class='youtube-container'>
    <iframe src='https://www.youtube.com/embed/dp62sNmT4UY?controls=0&showinfo=0&playsinline=1&autoplay=1&mute=1&loop=1&playlist=dp62sNmT4UY'></iframe>
</div>