Show Video Instead of Featured Image in WooCommerce single product page

Show video instead of featured image in woocommerce single product page

While working on a WooCommerce project, our client came up with this request to change featured image with youtube video for a specific product. Here is how we tackled this task.

Step 1:

First of all, we used a filter called “woocommerce_single_product_image_thumbnail_html” to inject our youtube video code.

Step 2:

Next, we copied the ID of the product on which we need to replace the video.

Step 3:

Here is the final working script. Make sure to replace product id on line 7 of this code to your specific product id. You will need to place this code into functions.php file of your child theme.

About Javed Iqbal

Mr. Javed Iqbal is a senior php developer and co-founder at MZ Creative Studio. His experience is more than 8 years in this field. He loves working on challenging projects.

Leave a Reply

Your email address will not be published.

Do you have a website project you’d like to discuss?

Get in touch