Hooks and Filters
Woo Document Preview Pro works by hooking into the free base plugin’s extension points and by exposing its own hooks for further customization. Everything below is defined in Pro’s own code.
Free base seams Pro hooks into
Section titled “Free base seams Pro hooks into”Pro registers callbacks on these filters provided by the free Document Preview for WooCommerce plugin. They are listed here so you know what Pro consumes, not because Pro defines them.
| Filter | What Pro does with it |
|---|---|
wcdp_preview_hook |
Points the preview button at the store owner’s configured position. |
wcdp_supported_extensions |
Narrows the base plugin’s supported formats to the allowed list (remove-only). |
wcdp_document_is_previewable |
Gates a single document by the allowed file types and services. |
wcdp_product_documents |
Hides previews on products outside the allowed categories. |
wcdp_meta_box_title |
Appends the allowed-file-types note to the product document metabox title. |
wcdp_admin_tabs |
Registers the Pro Settings and License tabs on the shared settings screen. |
wcdp_admin_view_path |
Resolves the view file for each Pro tab. |
Filters Pro defines
Section titled “Filters Pro defines”| Filter | Location | Purpose |
|---|---|---|
woo_document_preview_pro_supported_file_extensions |
Pro Settings tab | Adjust the list of file formats offered in the allowed file-types selector. Passes an associative array of extension => label. |
Actions Pro defines
Section titled “Actions Pro defines”The metabox renderer and the extension wrap points:
| Action | Fires | Arguments |
|---|---|---|
wcdp_pro_display_metabox_html |
Renders the shared document section (bound to the renderer). | $post_id |
wcdp_pro_admin_options_before |
Before the Pro settings form fields. | none |
wcdp_pro_admin_options_after |
After the Pro settings form fields. | none |
wcdp_pro_add_dokan_product_fields_before |
Before the Dokan document fields. | none |
wcdp_pro_add_dokan_product_fields_after |
After the Dokan document fields. | none |
wcdp_pro_add_wcfm_product_fields_before |
Before the WCFM document fields. | none |
wcdp_pro_add_wcfm_product_fields_after |
After the WCFM document fields. | none |
wcdp_pro_display_wcfm_dashboard_edit_page_before |
Before the WCFM edit-page document fields. | none |
wcdp_pro_display_wcfm_dashboard_edit_page_after |
After the WCFM edit-page document fields. | none |
wcdp_pro_display_wc_vendors_metabox_before |
Before the WC Vendors document fields. | none |
wcdp_pro_display_wc_vendors_metabox_after |
After the WC Vendors document fields. | none |
Example: add a custom format to the selector
Section titled “Example: add a custom format to the selector”add_filter( 'woo_document_preview_pro_supported_file_extensions', function ( $formats ) { $formats['rtf'] = 'RTF'; return $formats;} );Adding a format to this selector only changes what the owner can pick. Whether the format is actually previewable is still decided by the free base plugin’s supported set.

