How to configure Magento 2 product video?
Videos can be added from such external resources as YouTube and Vimeo video players in Magento 2. It can be added when creating or editing a product from the backend. If you want to perform your products in YouTube videos, then you need to obtain an API Key from your Google account and enter it into the configuration of your Magento store.
There's a simpler way round. You can add product videos via our Magento 2 Product Attachments module. In case you have’t moved to Magento 2, you can use the same extension for Magento.
Step 1: API Key Configurations
- Log in to your Google account and navigate to the Google Developers Console;
- Click the Create project button to make a new project;
- After the ?onfirmation is received choose the Credentials option on the left side of the panel to copy it:
You will be switched to API Credentials. Choose one of the options offered in the Create Credentials drop-down menu.
Step 2: Magento 2 Configurations
- Log in to the Admin Panel;
- Navigate to the Stores>Settings>Configuration:
- Choose Catalog on the left panel, expand the menu and choose the Catalog option:
- Expand the Product Video option:
- Paste your YouTube API Key here:
- Then click the Save Config button and refresh the cache.
Step 3: Link to the Video
- To add a video to the product gallery go to Magento 2 admin panel. In the Product Detail, choose Add Video in the Images and Videos section;
- Enter the URL of the YouTube or Vimeo video;
- Complete the Title and the Description of the video;
- Browse to the image and select the file to upload a Preview Image;
- To use the video metadata, choose the Get Video Information option;
- To assign the role to the video, mark the checkbox of each Role: Base Image; Small Image; Swatch Image; Thumbnail; Hide from Product Page;
- Don’t forget to click the Save button and refresh the cache.
Once you received the message, check whether all the settings were made correctly:
Magento 2 Product Video Configurations
Several product video options can be set in the config.xml configuration file. The settings can be done in the file of your custom module.
Magento 2 Product Video is not working
If you are not a tech-savvy admin user, you may have some difficulties while configuring product videos. For example, you can see a message saying:
Could not get preview image information. Please check your connection and try again.
This can signify some of the settings have been made incorrectly. Thus, if you have linked to a YouTube video, try to use the YouTube ID only (it’s displayed after v= in the URL).