I am trying to add a video underneath the gallery of a single product page (woocommerce). When I add the hook "woocommerce_product_thumbnails" nothing happens. I noticed that on the visual guide to woocommerce hooks it says "woocommerce_product_thumbnails (may not work with the new product gallery since WC 3.0)". Is there a work around to get this to work again?
Here is my current code:
add_action('woocommerce_product_thumbnails', 'add_product_video');
function add_product_video(){
echo "<iframe width='560' height='315' src='https://www.youtube.com/embed/JHN7viKRxbQ' frameborder='0' allowfullscreen></iframe>";
}
You can use do_action() function to make it possible in other way. In your woocommerce folder navigate to this path: woocommerce/templates/single-product/tabs/tabs.php
On the line no.22, add:
do_action("woocommerce_add_my_video");
And inside your theme functions.php, put:
add_action('woocommerce_add_my_video', 'add_product_video');
function add_product_video(){
echo "<iframe width='560' height='315' src='https://www.youtube.com/embed/JHN7viKRxbQ' frameborder='0' allowfullscreen></iframe>";
}
See the reference link here : Template Structure + Overriding Templates via a Theme
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With