Add Custom Product Video in Fotorama Gallery Magento 2

In this tutorial, Today We will explain to you how to add custom product video in fotorama gallery programmatically in Magento 2. In Magento 2, There is fotorama js used to show product images on the product page. But, It does not provide the functionality to show video in the gallery except YouTube video or Vimeo Video.

So, This technical note will help you to add custom product video in the product from your local storage. Let’s follow the steps :

You may also like,

How to Get Config Value in Layout XML in Magento 2.
How to Get Store Config Value in Magento 2.

1) First of all, You need to override gallery.phtml file at app/design/frontend/VendorName/ThemeName/Magento_Catalog/templates/product/view/ and paste the below code :

You need to add this code in your js file or in phtml file inside <script> tag.

In thumb param, you need to set your thumbnail image path. In src param, you need to set your video URL and in last, in caption param, you need to set your caption.

2) Last, You need to clean cache by this below command :

That’s it.

I hope this blog will helpful for easily understand how to add custom product video in fotorama gallery programmatically in Magento 2. In case, I missed anything or need to add some information, always feel free to leave a comment in this blog, I’ll get back with proper solution.

Share this: