Zen Cart Logo
Forums / All Other Contributions/Addons / YouTube Videos display for Zen Cart [Support Thread]

YouTube Videos display for Zen Cart [Support Thread]

Views: 4,001

Results 1 to 11 of 11
12 Feb 2026, 1:27 PM
#1
richard7315 avatar

richard7315

New Zenner

Join Date:
Jul 2017
Location:
West Midlands, UK
Posts:
51
Plugin Contributions:
1

YouTube Videos display for Zen Cart [Support Thread]

Hi,
I have just submitted a new module to allow YouTube video display on products. It is now available on Github.

Overview

This module adds YouTube video functionality to Zen Cart product pages. Store owners can easily add a YouTube video ID to any product in the admin panel, and the video will be displayed on the product's detail page in the storefront.

Features

  • Easy Admin Interface: Add YouTube video IDs directly in the product edit form
  • Responsive Video Display: Videos are displayed in a responsive iframe that adapts to different screen sizes
  • Privacy-Focused: Uses youtube-nocookie.com domain to minimize tracking

Requirements

  • Zen Cart v2.0.0 or higher (tested with v2.1.0)
  • PHP 7.4 or higher

Moderators – please use the second version I submitted (v1.0.1) with the updated readme file.

15 Feb 2026, 11:47 AM
#2
richard7315 avatar

richard7315

New Zenner

Join Date:
Jul 2017
Location:
West Midlands, UK
Posts:
51
Plugin Contributions:
1

Re: YouTube Videos display for Zen Cart [Support Thread]

Zen Cart Iframes In Product Descriptions

The reason I developed this module was due to the limitations with CKEditor 5 – any existing iframes are removed when saving product descriptions. Essentially, iframes are no longer supported in Zen Cart 2.1.0 product descriptions.

This module allows YouTube video iframes to be embedded on product pages – hopefully this will be helpful to some users.

15 Feb 2026, 11:50 AM
#3
richard7315 avatar

richard7315

New Zenner

Join Date:
Jul 2017
Location:
West Midlands, UK
Posts:
51
Plugin Contributions:
1

Re: YouTube Videos display for Zen Cart [Support Thread]

Following some very helpful feedback on GitHub I have updated the module to version 1.0.3. The following changes have been made:

  1. Module has been refactored to eliminate the need for a modified main_template_vars.php
  2. The module now only requires one modified core file (tpl_product_info_display.php for the HTML) instead of two, significantly reducing upgrade conflicts and maintenance burden.
  3. Removed the need for the admin auto-loading config file
15 Feb 2026, 12:10 PM
#4
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,798
Plugin Contributions:
22

Re: YouTube Videos display for Zen Cart [Support Thread]

Nice one!

May I just suggest one tiny improvement? Don't force admins to "extract" the video ID - it's a waste of time and leaves room for error (by accidentally deleting a character). Allowing a copy/paste from the address bar or using the Share button on YT makes it easier and much faster for the admin... Here's a function I use on multiple sites (tested):

function extractYouTubeID($url) {
    // If it's already an ID (no "http" in it), return as is
    if (preg_match('/^[a-zA-Z0-9_-]{11}$/', $url)) {
        return $url;
    }

    // Parse the URL
    $parsedUrl = parse_url($url);

    // Check for short YouTube URL
    if (isset($parsedUrl['host']) && $parsedUrl['host'] === 'youtu.be' && isset($parsedUrl['path'])) {
        return ltrim($parsedUrl['path'], '/');
    }

    if (!isset($parsedUrl['query'])) {
        return false; // Invalid format
    }

    // Parse query parameters
    parse_str($parsedUrl['query'], $queryParams);

    // Return the video ID if it exists
    return $queryParams['v'] ?? false;
}

You can place it in your observer file and simply call it instead of ```
$youtube_video_id = preg_replace('/[^a-zA-Z0-9_-]/', '', $youtube_video_id);

15 Feb 2026, 2:39 PM
#5
richard7315 avatar

richard7315

New Zenner

Join Date:
Jul 2017
Location:
West Midlands, UK
Posts:
51
Plugin Contributions:
1

Re: YouTube Videos display for Zen Cart [Support Thread]

Many thanks for your suggestion. Your right, that would be much easier for end users.

I've updated the module to v1.0.4 incorporating your extractYouTubeID() function - users can now simply paste full YouTube URLs, short URLs or just the video ID, and the system automatically handles the extraction.

I have sent v1.0.4 to Zen Cart for review. Your feedback is much appreciated.

19 Feb 2026, 6:33 AM
#6
dw08gm avatar

dw08gm

Totally Zenned

Join Date:
Sep 2008
Location:
DownUnder, overlooking South Pole.
Posts:
1,017
Plugin Contributions:
2

Re: YouTube Videos display for Zen Cart [Support Thread]

could this plugin be used to add videos to banners?

19 Feb 2026, 4:23 PM
#7
richard7315 avatar

richard7315

New Zenner

Join Date:
Jul 2017
Location:
West Midlands, UK
Posts:
51
Plugin Contributions:
1

Re: YouTube Videos display for Zen Cart [Support Thread]

dw08gm:

could this plugin be used to add videos to banners?

Unfortunately, this mod is currently only suitable for adding YouTube videos to the product info page. However, I am currently testing a new slider & banner module. I plan to include the following functionality with the new mod:

Standard (single) banner
Slider (slideshow) banners
Tile banners (grid layout of multiple banners)
YouTube video banner (standard single video display)

I intend to allow a YouTube video ID or URL to be entered in the admin – this would be ideal for a homepage video banner. I believe YouTube video banners can be created using third-party software such as adobe express

Is this what you had in mind, or were you looking to add self-hosted videos or other functionality?

If the new mod is of interest, please let me know and I will publish a copy for beta testing.

21 Mar 2026, 6:00 PM
#8
nwce avatar

nwce

Zen Follower

Join Date:
Oct 2009
Posts:
444
Plugin Contributions:
0

Re: YouTube Videos display for Zen Cart [Support Thread]

Thanks for a great plugin richard7315!

Installed very easily and is such a useful marketing assist on my site!

6 Jul 2026, 10:10 PM
#9
goldbuckle avatar

goldbuckle

Zen Follower

Join Date:
Dec 2006
Location:
near Atlanta Georgia
Posts:
220
Plugin Contributions:
0

Re: YouTube Videos display for Zen Cart [Support Thread]

Richard,
Has this been approved by the ZC admins as an official module yet? I'd like to add this to my ZC 2.0.1

richard7315:

Many thanks for your suggestion. Your right, that would be much easier for end users.

I've updated the module to v1.0.4 incorporating your extractYouTubeID() function - users can now simply paste full YouTube URLs, short URLs or just the video ID, and the system automatically handles the extraction.

I have sent v1.0.4 to Zen Cart for review. Your feedback is much appreciated.

7 Jul 2026, 8:40 AM
#10
richard7315 avatar

richard7315

New Zenner

Join Date:
Jul 2017
Location:
West Midlands, UK
Posts:
51
Plugin Contributions:
1

Re: YouTube Videos display for Zen Cart [Support Thread]

Hi GoldBuckle
Yes, the approved module can now be downloaded here in the Zen Cart Plugins section. If you are using ZC 2.0.1 you will need to manually edit tpl_product_info_display.php. Full details are included in the readme file.
Richard

7 Jul 2026, 1:04 PM
#11
goldbuckle avatar

goldbuckle

Zen Follower

Join Date:
Dec 2006
Location:
near Atlanta Georgia
Posts:
220
Plugin Contributions:
0

Re: YouTube Videos display for Zen Cart [Support Thread]

Thanks Richard!

richard7315:

Hi GoldBuckle
Yes, the approved module can now be downloaded here in the Zen Cart Plugins section. If you are using ZC 2.0.1 you will need to manually edit tpl_product_info_display.php. Full details are included in the readme file.
Richard