WordPress Custom Plugin
A lightweight WordPress plugin that injects dynamic product document sections into WooCommerce product pages using hooks, ACF, and taxonomy-aware logic. Designed to replace theme snippets with a maintainable plugin architecture.
by Carly Lau · github.com/carlylau-marketing/wordpress-custom-plugin · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/carlylau-marketing/wordpress-custom-plugin/archive/refs/heads/main.zipWooCommerce Product Documents Enhancer
A lightweight WordPress plugin that injects dynamic product document sections into WooCommerce product pages using hooks, ACF, and taxonomy-aware logic. Designed to replace theme snippets with a maintainable plugin architecture.
Version: 1.1.0
License: GPL-2.0+
Platform: WordPress / WooCommerce
Dependencies: WooCommerce, Advanced Custom Fields (ACF)
Overview
This plugin adds a custom Downloads tab to WooCommerce product pages, displaying:
- Product certification documents
- Light photometric files (IES / LDT)
The solution is implemented as a standalone plugin to ensure stability across theme updates and to avoid fragile theme-based PHP snippets.
Key Features
- WooCommerce-native product tab integration
- Automatic certificate discovery via product taxonomy mapping
- Photometric file support using ACF Post Object relationships
- Shared photometrics across multiple products
- External PDF redirect handling
- Theme-agnostic architecture (tested with Porto)
Architecture Highlights
- No shortcodes
- No page builder dependency
- Pure WooCommerce hooks
- Safe execution order
- Update-resistant plugin design
The project evolved from theme snippets into a structured plugin after theme updates removed custom PHP logic, a real-world refactor scenario.
ACF Field Configuration
Light Photometrics (Custom Post Type)
| Field Name | Type | Notes |
|---|---|---|
related_product |
Post Object (multiple) | Links photometrics to products |
light_photometrics_ies |
URL | Google Drive Share Links (unsupported file type by WordPress) |
light_photometrics_ldt |
URL | Google Drive Share Links (unsupported file type by WordPress) |
Installation
- Upload plugin to:
wp-content/plugins - Activate via WordPress Admin
- Ensure WooCommerce & ACF are active
Version History
v1.1.0
- Removed shortcode dependency
- Stabilised WooCommerce tab rendering
- Fixed execution-order related fatal errors
- Production-ready plugin architecture
v1.0.0
- Initial extraction from theme snippets
- Certificates + photometrics table rendering
- PDF redirect handling
Notes for Reviewers
This plugin demonstrates:
- Practical WordPress plugin architecture
- Debugging of fatal errors caused by execution order
- Refactoring from theme-level code to a portable solution
- Real-world WooCommerce + ACF integration