Skip to content

Template overrides

Every piece of customer facing markup is a template, loaded with the same override contract WooCommerce itself uses. Restyle the preview without editing plugin files that an update would overwrite.

Copy a template into your theme:

yourtheme/woo-document-preview/<template-name>.php

The loader searches the child theme first, then the parent theme, then the plugin’s own templates/ directory. The theme directory name (woo-document-preview) can be changed with the wcdp_template_theme_directory filter, and the resolved path with wcdp_locate_template.

Template What it renders
preview-button.php A single document preview button. Receives already computed and escaped values.
preview-container.php The wrapper and heading around a product’s preview buttons.
pdf-viewer.php The local pdf.js viewer page, loaded inside the modal for PDFs. Has the Previous and Next page controls.
local-preview.php The fallback page for a document the local viewer cannot render, on a site that is not publicly reachable. Offers a download and, where possible, a viewer iframe.

Buttons carry inline SVG icons. WordPress wp_kses_post() strips <svg>, so output icon markup through wcdp_kses_icon() rather than wp_kses_post(), or the icon renders as an empty gap.