Skip to content

Hooks reference

The plugin fires 17 extension points: 1 action and 16 filters. In the repository this reference is generated from the source by bin/generate-hook-docs.php.

Hook Purpose
wcdp_render_preview Render the preview block for the current global product. Both tiers hook their renderer here; the shortcode and block also fire it, so manual and automatic placement cannot drift.
Hook Purpose
wcdp_supported_extensions The file extensions eligible for a preview.
wcdp_document_sources The embeddable cloud sources. Add a service by adding a key with patterns, embed_template, and type. This is the sanctioned way to teach the plugin a new service.
wcdp_detected_document_source A single URL detection result, after a source matches.
wcdp_document_is_previewable Whether a document will show a preview. Return false to exclude one. Pro uses this for the store owner’s allowed formats setting.
wcdp_product_documents A product’s documents after normalisation.
wcdp_renderer_for_document The renderer chosen for a document. The seam for supplying your own viewer, such as a Pro renderer that adds watermarking.
wcdp_preview_hook The WooCommerce action the product page preview attaches to.
wcdp_render_product_preview Whether this plugin renders the product page preview itself. An extension that renders its own returns false so the shopper sees one preview, not two.
wcdp_public_instance The object that renders the public side. The rebind point for an extension that subclasses the public class. Pro returns its subclass here.
wcdp_load_assets Force the preview assets to load on a request, for a page where WordPress cannot see the shortcode or block in advance.
wcdp_locate_template The resolved template path. Lets an extension supply its own template without copying the loader.
wcdp_template_theme_directory The directory name looked for inside the theme. Defaults to woo-document-preview.
wcdp_is_local_environment Whether the site is treated as unreachable from the internet. Override on a staging site that sits on a public domain but is password protected.
wcdp_meta_box_title The documents meta box title. The seam an extension uses to append a note instead of registering a second meta box.
wcdp_admin_tabs The admin panel’s screens. Pro adds its settings screens here rather than registering a second menu page.
wcdp_admin_view_path The view file a settings tab renders, so a Pro or third party screen can change it.

The admin panel is drawn by a shared Wbcom settings library. That library fires wcdp_settings_nav_groups (filter) and wcdp_settings_tab_content (action); this plugin consumes them through a bridge that maps the wcdp_admin_tabs registry onto them. Extend the panel through wcdp_admin_tabs, which keeps working across the bridge.