From your Shopify admin, go to "Products".
Click a product to see its details page.
Click Add media and then click on "Embed video".
Add a video url of the product hosted on YouTube or Vimeo.
We can also upload the videos which are from other platform like Wistia, or mp4 videos. For that we need to follow the below steps.
We need to upload an image and give the alt description for the image.
Based on this alt description we can modify the liquid code and add the video. For that, go to the product-template.liquid file which is present in "Sections" folder.
Edit the code after the line {% for image in product.images %}
Add the below code to display the video on the product gallery of the product page
{% for image in product.images %}
{% if image.alt contains 'vid' %}
Add video code here
{% else %}
{% assign featured_image = image.src %}
<img id="ProductPhotoImg" class="product_variant_image"
data-image-id="{{ image.id }}" alt="{{ featured_image.alt | escape }}"
src="{{ featured_image | img_url: '1024x1024' }}" width="1024" height="1024">
{% endif %}
{% endfor %}
By following all the above steps, we can display on the product's gallery.