Hello @dawnmb!
No need to overwrite any files—there are numerous action hooks available on the shop page that you can use to insert additional content.
Here’s an example that will position the video below the page title:
add_action('woocommerce_before_shop_loop', 'add_youtube_video_to_shop_page', 10);
function add_youtube_video_to_shop_page() {
if (!is_shop()) {
return;
}
else {
// Replace the ID "jNQXAC9IVRw" with your own
$youtube_video_url = 'https://www.youtube.com/embed/jNQXAC9IVRw';
$youtube_embed_code = '<div class="youtube-video-container">
<iframe width="560" height="315" src="' . esc_url($youtube_video_url) . '" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>';
echo $youtube_embed_code;
}
}
Simply replace the video ID “jNQXAC9IVRw” with your own and add the code snippet using the Code Snippets plugin. The video ID is the string that appears after v= in the URL of the video page.
Cheers!
Zee
(@doublezed2)
Hello dawnmb,
Thank you for contacting WooCommerce support.
I understand you want to add a video to the WooCommerce shop page.
I agree with Saif, using the hooks is the best way to accomplish your goal.
If you need any help from a developer, You can find a good developer at Codeable.io or WooExperts.
Saif, I appreciate you for helping out here.
Best regards.