
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.