PDF Product Catalogs for WooCommerce
Overview
Product overview
Plugin: PDF Product Catalogs for WooCommerce Version inspected: 0.7.19 Author: Scott Mays / Athenian Brands Platform: WordPress 6.2+ / WooCommerce 7.0+ PHP requirement: PHP 8.0+ Primary use case: Generate branded WooCommerce product catalog PDFs from selected products, product categories, reusable JSON templates, and shortcode-builder layout profiles.
---
Use cases
- Wholesale catalogs
- Seasonal product books
- Sales collateral
- Catalog export workflows
Developer
Developer starting point
This baseline is generated from the reviewed local technical reference and source folder. Deployed-version parity and external-provider effects remain separate verification steps.
Admin Workflow
1. Create or Edit a Catalog
An administrator opens:
WooCommerce > PDF CatalogsThen they create a new catalog or edit an existing catalog record.
2. Choose a Template
The user selects a layout template, typically the bundled shortcode-builder template or a user-created/uploaded template.
3. Choose a Settings Profile
For shortcode-builder layouts, the user can choose a saved template settings profile. This profile controls design and rendering settings while the catalog itself controls the actual product/category selection.
4. Select Product Data
The user selects included categories, excluded categories, and/or individual products.
The final product set is built by merging selected products and category products, then removing products that belong to excluded categories.
5. Configure Output Options
The user can configure:
- Image size.
- Category grouping.
- Product URL inclusion.
- Product card width.
- Extra product meta keys.
6. Save the Catalog
The plugin saves the catalog definition and associated metadata.
7. Generate the PDF
The user clicks Generate PDF. The plugin marks the catalog as queued, clears any previous file reference/log, and schedules the generation job.
8. Review or Download
When generation completes, the admin status card shows the generated PDF link.
---
Technical Architecture
Main Bootstrap File
athenian-pdf-product-catalogs.phpResponsibilities:
- Declares plugin metadata.
- Defines constants.
- Loads the autoloader.
- Confirms WooCommerce is active.
- Initializes the plugin on
plugins_loaded.
Important constants:
ATH_PPC_VERSION
ATH_PPC_FILE
ATH_PPC_PATH
ATH_PPC_URL
ATH_PPC_SLUGNamespace
The plugin uses the namespace:
Athenian\PDFProductCatalogsAutoloading
The plugin includes a simple PSR-style autoloader:
includes/Support/Autoloader.phpClasses under Athenian\PDFProductCatalogs\ are mapped to files under:
includes/<ClassPath>.phpCore Plugin Class
includes/Plugin.phpResponsibilities:
- Registers the hidden catalog CPT.
- Initializes admin pages.
- Initializes background generation jobs.
- Initializes persistence helpers.
- Initializes shortcode runtime.
- Creates upload directories on activation.
- Flushes rewrite rules on activation/deactivation.
Admin Layer
includes/Admin/Admin.php
includes/Admin/Pages/CatalogsPage.php
includes/Admin/Pages/TemplatesPage.phpResponsibilities:
- Adds WooCommerce submenu pages.
- Enqueues admin CSS/JS.
- Localizes AJAX nonce and URL.
- Renders catalog list and edit screens.
- Handles catalog save/delete/generate actions.
- Renders template management and builder screens.
- Handles template upload, duplicate, preview, and delete operations.
Job Layer
includes/Jobs/GenerateCatalogJob.phpResponsibilities:
- Registers the generation hook.
- Queues catalog generation using Action Scheduler when available.
- Falls back to WP-Cron when Action Scheduler is not available.
- Sets status metadata before and after generation.
- Captures generation errors and stack traces in catalog log metadata.
PDF Layer
includes/PDF/CatalogGenerator.php
includes/PDF/MiniPDF.phpResponsibilities:
- Collects selected WooCommerce products.
- Applies category include/exclude logic.
- Resolves template configuration.
- Groups products by category when enabled.
- Generates output PDF paths.
- Renders shortcode-builder output through HTML/CSS and Dompdf when available.
- Writes fallback PDFs when needed.
- Converts WooCommerce images to JPEG-compatible temporary files.
- Supports legacy/vector drawing through MiniPDF.
Template Support Layer
includes/Support/Templates.php
includes/Support/TemplateBuilder.php
includes/Support/ShortcodeTemplateRuntime.php
includes/Support/Util.phpResponsibilities:
- Discover plugin and uploaded templates.
- Parse CSS variables from template CSS.
- Convert CSS colors to RGB for PDF drawing.
- Build template manifests from builder payloads.
- Save user-authored templates to uploads.
- Render preview documents.
- Resolve dynamic placeholders.
- Render shortcode-based catalog previews.
- Store and retrieve saved template configurations.
- Provide product/category sample data when WooCommerce data is unavailable.
---
Data Model
Custom Post Type
ath_pdf_catalogThe CPT stores saved catalog records. It is private, not publicly queryable, and not shown in the standard WordPress admin menu.
Catalog Post Meta
| Meta key | Purpose | |---|---| | _ath_ppc_template | Selected template ID. | | _ath_ppc_shortcode_config_key | Saved shortcode-builder settings profile key. | | _ath_ppc_product_card_width | PDF product card width override, 0–420. | | _ath_ppc_include_desc | Legacy/back-compat description toggle. Current generator notes descriptions are no longer rendered in the non-shortcode path. | | _ath_ppc_include_url | Whether to include product URL / product link button where supported. | | _ath_ppc_group_by_cat | Canonical category grouping flag used by the custom admin screen and generator. | | _ath_ppc_image_size | WordPress/WooCommerce image size used for catalog output. | | _ath_ppc_category_ids | Included WooCommerce product category term IDs. | | _ath_ppc_exclude_category_ids | Excluded WooCommerce product category term IDs. | | _ath_ppc_product_ids | Explicitly included WooCommerce product IDs. | | _ath_ppc_extra_meta_keys | Additional product meta keys for template-supported output. | | _ath_ppc_status | Catalog generation state. | | _ath_ppc_log | Last generation error/log output. | | _ath_ppc_file_rel | Relative upload path of generated PDF. | | _ath_ppc_generated_at | Last generated timestamp. |
Options
| Option key | Purpose | |---|---| | ath_ppc_shortcode_template_configs | Stores saved shortcode-builder catalog settings and section configurations by key. |
Upload Paths
| Path | Purpose | |---|---| | wp-content/uploads/ath-pdf-catalogs/ | Generated PDFs and companion HTML exports. | | wp-content/uploads/ath-pdf-catalogs/tmp/ | Temporary converted JPEG files. | | wp-content/uploads/ath-pdf-catalogs/templates/ | Uploaded or user-authored template packages. |
---
AJAX Endpoints
Catalog Admin Endpoints
| Action | Purpose | |---|---| | ath_ppc_search_products | Search WooCommerce products for the admin product selector. | | ath_ppc_catalog_status | Poll catalog generation status and generated file URL. | | ath_ppc_run_catalog | Runs queued/generating catalog generation during admin polling. |
Template Admin Endpoints
| Action | Purpose | |---|---| | ath_ppc_template_preview | Render saved template preview. | | ath_ppc_builder_preview | Render builder preview document from submitted builder payload. | | ath_ppc_builder_load | Load template payload into the admin builder. |
Shortcode Builder Endpoints
| Action | Purpose | |---|---| | ath_ppc_stb_render_preview | Render live shortcode-builder preview. | | ath_ppc_stb_load_template | Load a shortcode-builder template and its saved config. | | ath_ppc_stb_save_config | Save shortcode-builder catalog settings and section configuration. | | ath_ppc_stb_create_template | Save a shortcode-builder payload as a user template package. | | ath_ppc_stb_duplicate_template | Duplicate an existing shortcode-builder template. | | ath_ppc_stb_delete_template | Delete a user-created shortcode-builder template. | | ath_ppc_stb_products_for_category | Fetch product choices for a selected WooCommerce category. |
All admin and shortcode-builder AJAX routes require appropriate nonce validation. Administrative routes also require manage_woocommerce or manage_options capabilities.
---
Hooks and Extension Points
Actions
| Hook | Purpose | |---|---| | ath_ppc_generate_catalog | Background generation hook used by Action Scheduler or WP-Cron. |
Filters
| Filter | Purpose | |---|---| | ath_ppc_templates_v2 | Filter the discovered template list before display/use. | | ath_ppc_catalog_products | Filter the final collected WooCommerce product array before generation. | | ath_ppc_extra_meta_lines | Filter extra product meta lines rendered into product cards. |
These hooks make it possible to customize product inclusion, enrich product metadata, add template packages programmatically, or modify catalog output behavior without editing core plugin files.
---
Template System
Template Discovery
Template folders are scanned from plugin and uploads directories. Each template folder must contain a JSON manifest and may contain a CSS file and preview image.
Recognized manifest filenames:
template.json
manifest.jsonThe folder name must match the manifest id.
Built-In Template Note
The package includes a templates/list folder, but the current template scanner intentionally only exposes the newer shortcode_builder bundled template from the plugin template directory. Uploaded/user templates are also loaded and can override built-in templates.
This suggests the plugin has moved from older fixed layouts toward the JSON/shortcode-builder template workflow.
Template Manifest Concepts
Template manifests may define:
- Template ID.
- Template name.
- Description.
- Source.
- Schema version.
- Layout mode.
- Page dimensions.
- Fonts.
- Builder runtime.
- Global catalog settings.
- Sections.
- Section design types.
- Preview templates.
CSS Variables
The template scanner parses CSS variables from template CSS and can use those variables to drive PDF theming.
Supported color parsing includes:
- Hex colors such as
#ec8639. - Short hex colors such as
#fff. rgb(r,g,b)values.var(--token)references where the referenced variable exists.
---
Rendering Flow
Shortcode-Builder PDF Flow
- Load the selected template.
- Load the selected saved config profile.
- Merge saved catalog settings into the template global settings.
- Merge saved sections into the template sections.
- Apply product card width override.
- Resolve PDF orientation.
- Collect selected product IDs and category IDs.
- Render standalone HTML from the template/runtime.
- Write the companion
.htmlexport file. - Use Dompdf if available to generate PDF.
- If Dompdf is unavailable, write a MiniPDF fallback/stub PDF.
- Store the generated relative PDF path in catalog meta.
Product Collection Flow
- Start with explicitly selected product IDs.
- Add products from included categories using
WC_Product_Query. - Remove any products assigned to excluded categories.
- Load each product via
wc_get_product(). - Sort products alphabetically by product name.
- Apply the
ath_ppc_catalog_productsfilter.
Image Handling
The generator resolves WooCommerce product image paths using the selected image size. It attempts to use local upload paths when possible and falls back to the attachment file path. Non-JPEG images are converted to temporary JPEG files using GD functions when available.
Temporary JPEG files are stored under:
wp-content/uploads/ath-pdf-catalogs/tmp/Old temporary JPEG files are cleaned up after a six-hour cutoff.
---
Security and Permissions
The plugin uses several WordPress security patterns:
- Exits when accessed outside WordPress.
- Requires WooCommerce to be active.
- Restricts admin pages to
manage_woocommerceormanage_optionsusers. - Uses nonces for admin form actions.
- Uses AJAX nonce validation for admin and shortcode-builder endpoints.
- Sanitizes template IDs using
sanitize_key(). - Sanitizes text fields, category/product IDs, meta keys, and numeric width values.
- Uses
wp_safe_redirect()after admin actions. - Uses
wp_kses_post()for builder HTML where rich template markup is expected. - Prevents deletion of built-in templates from the uploaded-template delete path.
---
Technical Observations
Strong Architecture
The plugin has a clean namespace, a simple autoloader, isolated admin pages, a job class, a PDF generator class, a template discovery layer, and a shortcode runtime. This makes the plugin relatively easy to extend compared with a single-file procedural implementation.
Template Direction Is Clear
Although legacy grid/list concepts remain in parts of the code, the current package clearly emphasizes the shortcode_builder runtime and JSON-backed template workflow. That is the most flexible direction for branded catalogs.
Dompdf Should Be Treated as a Production Dependency
For the current shortcode-builder layout path, Dompdf is the preferred PDF renderer. In production, this should likely be documented as a recommended or required dependency if the business expects exact HTML/CSS-to-PDF output.
Minor Legacy Persistence Mismatch
CatalogsPage uses _ath_ppc_group_by_cat as the canonical group-by-category key. The separate Admin\Persist helper stores _ath_ppc_group_by_category. Since the custom admin screen is the primary workflow and the generator reads _ath_ppc_group_by_cat, the current catalog workflow works from the custom screen. The Persist helper appears to be a legacy or fallback save-post helper and may need cleanup or key alignment in a future hardening pass.
Built-In List Template Is Present but Hidden
The ZIP contains a templates/list package, but Templates::list_templates() currently only exposes shortcode_builder from bundled plugin templates. This may be intentional, but if the list layout should be available in the UI, the scanner logic would need to be revised.
---
Implementation Snapshot
Main Files
| File | Purpose | |---|---| | athenian-pdf-product-catalogs.php | Plugin bootstrap and WooCommerce dependency check. | | includes/Plugin.php | Core initialization and CPT registration. | | includes/Admin/Admin.php | WooCommerce admin menu and asset loading. | | includes/Admin/Pages/CatalogsPage.php | Catalog list, edit, save, delete, generate, and AJAX status/search logic. | | includes/Admin/Pages/TemplatesPage.php | Template management, upload, duplicate, preview, and builder UI. | | includes/Admin/Persist.php | Legacy/fallback save-post persistence helper. | | includes/Jobs/GenerateCatalogJob.php | Action Scheduler / WP-Cron generation queue. | | includes/PDF/CatalogGenerator.php | Product collection, template resolution, HTML/PDF generation, and file output. | | includes/PDF/MiniPDF.php | Lightweight internal PDF writer. | | includes/Support/Templates.php | Template discovery, CSS variable parsing, template loading. | | includes/Support/TemplateBuilder.php | Template payloads, manifests, preview rendering, token resolution. | | includes/Support/ShortcodeTemplateRuntime.php | Shortcodes, preview runtime, saved config storage, product/category rendering. | | includes/Support/Util.php | Upload paths, timestamps, text sanitization, truncation helpers. |
Asset Files
| File | Purpose | |---|---| | assets/css/admin.css | Admin UI styling for catalog and template screens. | | assets/js/admin.js | Admin Select2 product search, template UI behavior, preview, and generation polling. | | assets/css/shortcode-template-builder.css | Frontend/shortcode builder styling. | | assets/js/shortcode-template-builder.js | Shortcode builder interaction, AJAX preview/save/load/create/duplicate/delete behavior. |
---
Install
- Reviewed source folder: athenian-pdf-product-catalogs
- Plugin version reviewed: 0.7.19
- Local source inventory: 29 files (vendor, temporary, test, and Git metadata excluded).
- GitHub baseline: https://github.com/Athenian-Brands/athenian-pdf-product-catalogs at baseline/devdocs-0.7.19-20261006 / cbb8154e5a25c3beae1fafd1ce5a6f85489179ba.
- WordPress and WooCommerce.
- PDF rendering, fonts, media, and generated-file storage should be tested in the target environment.
Configuration
- Technical & Marketing Overview — see the linked technical reference excerpt.
- Executive Summary — see the linked technical reference excerpt.
- Marketing Positioning — see the linked technical reference excerpt.
- Core Feature Highlights — see the linked technical reference excerpt.
- Admin Workflow — see the linked technical reference excerpt.
- Technical Architecture — see the linked technical reference excerpt.
- Data Model — see the linked technical reference excerpt.
- AJAX Endpoints — see the linked technical reference excerpt.
- Hooks and Extension Points — see the linked technical reference excerpt.
- Template System — see the linked technical reference excerpt.
- Rendering Flow — see the linked technical reference excerpt.
- Security and Permissions — see the linked technical reference excerpt.
- Compatibility Notes — see the linked technical reference excerpt.
- Technical Observations — see the linked technical reference excerpt.
Usage
- Shortcodes detected in local PHP source: 2
- Static action/filter hooks detected in local PHP source: 21
- REST route registrations detected in local PHP source: 0
Shortcodes
- ath_pdf_catalog_template_builder — includes/Support/ShortcodeTemplateRuntime.php
- pdf_catalog_template — includes/Support/ShortcodeTemplateRuntime.php
REST Endpoints
- No register_rest_route calls were detected by the baseline scanner.
Hooks
- admin_enqueue_scripts — includes/Admin/Admin.php
- admin_init — includes/Admin/Pages/CatalogsPage.php
- admin_menu — includes/Admin/Admin.php
- admin_notices — athenian-pdf-product-catalogs.php
- init — includes/Plugin.php
- plugins_loaded — athenian-pdf-product-catalogs.php
- save_post_ — includes/Admin/Persist.php
- wp_ajax_ath_ppc_builder_load — includes/Admin/Pages/TemplatesPage.php
- wp_ajax_ath_ppc_builder_preview — includes/Admin/Pages/TemplatesPage.php
- wp_ajax_ath_ppc_catalog_status — includes/Admin/Pages/CatalogsPage.php
- wp_ajax_ath_ppc_run_catalog — includes/Admin/Pages/CatalogsPage.php
- wp_ajax_ath_ppc_search_products — includes/Admin/Pages/CatalogsPage.php
- wp_ajax_ath_ppc_stb_create_template — includes/Support/ShortcodeTemplateRuntime.php
- wp_ajax_ath_ppc_stb_delete_template — includes/Support/ShortcodeTemplateRuntime.php
- wp_ajax_ath_ppc_stb_duplicate_template — includes/Support/ShortcodeTemplateRuntime.php
- wp_ajax_ath_ppc_stb_load_template — includes/Support/ShortcodeTemplateRuntime.php
- wp_ajax_ath_ppc_stb_products_for_category — includes/Support/ShortcodeTemplateRuntime.php
- wp_ajax_ath_ppc_stb_render_preview — includes/Support/ShortcodeTemplateRuntime.php
- wp_ajax_ath_ppc_stb_save_config — includes/Support/ShortcodeTemplateRuntime.php
- wp_ajax_ath_ppc_template_preview — includes/Admin/Pages/TemplatesPage.php
- wp_enqueue_scripts — includes/Support/ShortcodeTemplateRuntime.php
Data Model
- Data Model — described in the local technical reference.
API Reference
- Local source digest: dd193c33415d4872d01d8be8e84d249ba9685e6c8215794cf20ab968bc6b2a76
- Repository URL: https://github.com/Athenian-Brands/athenian-pdf-product-catalogs
- Repository reference: baseline/devdocs-0.7.19-20261006
- Repository commit: cbb8154e5a25c3beae1fafd1ce5a6f85489179ba
Source files include: assets/css/admin.css, assets/css/shortcode-template-builder.css, assets/js/admin.js, assets/js/shortcode-template-builder.js, athenian-pdf-product-catalogs.php, athenian-pdf-product-catalogs.zip, athenian-product-catalogs-icon.png, docs/athenian-platform-marketing.md, docs/athenian-platform-technical.md, docs/technical-marketing.md, includes/Admin/Admin.php, includes/Admin/Pages/CatalogsPage.php, includes/Admin/Pages/TemplatesPage.php, includes/Admin/Persist.php, includes/Jobs/GenerateCatalogJob.php, includes/PDF/CatalogGenerator.php, includes/PDF/CatalogGenerator.php.20260519083029.bak, includes/PDF/MiniPDF.php, includes/Plugin.php, includes/Support/Autoloader.php, includes/Support/ShortcodeTemplateRuntime.php, includes/Support/ShortcodeTemplateRuntime.php.20260519083029.bak, includes/Support/TemplateBuilder.php, includes/Support/Templates.php, includes/Support/Util.php, templates/list/style.css, templates/list/template.json, templates/shortcode_builder/style.css, …
Troubleshooting
- This baseline is generated from the reviewed local technical reference and source folder. Deployed-version parity and external-provider effects remain separate verification steps.
- Confirm the deployed plugin version, active dependencies, and current repository tree before using implementation details as a release contract.
- Treat payment, carrier, vendor, shipment, inventory, account, credential, and external-provider behavior as integration-dependent until exercised in the target environment.
FAQ
What is this page intended to establish?
A versioned, product-linked starting point for iterative developer documentation. It combines the local implementation reference with a compact detected-code inventory and a committed GitHub baseline.
Is the linked repository baseline verified?
Yes. The repository URL, ref, and commit recorded on this page were verified from the clean GitHub baseline prepared for this documentation pass. That does not by itself prove fleet deployment parity.
What remains for release-grade documentation?
Reconcile the recorded source baseline with the deployed plugin version, then exercise the relevant authenticated, store, provider, payment, carrier, or generated-artifact paths in the target environment.