Support » Plugin: WooCommerce PDF Invoices & Packing Slips » Creating a custom PDF template in Plugin

  • Resolved valousal

    (@valentinanamorphik)


    Hello,

    Is it possible to create a custom template in a plugin?

    I would like to create a custom PDF template in a plugin and not in the theme.

    wp-content / plugins / my plugin / woocommerce / pdf / yourtemplate

    Thanks for your help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Ewout

    (@pomegranate)

    Hi! That’s certainly possible, you can use the wpo_wcpdf_template_paths filter to include your plugin.
    Here’s an example that will look for the template folders in your-plugin/templates (which will them show up in the settings):

    
    function wpo_wcpdf_template_paths_plugin($template_paths) {
    	$template_paths[] = untrailingslashit( plugin_dir_path( __FILE__ ) ) . '/templates/';
    	return $template_paths;
    }
    add_filter( 'wpo_wcpdf_template_paths', 'wpo_wcpdf_template_paths_plugin', 10, 1 );
    
    valousal

    (@valentinanamorphik)

    Thanks !

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Creating a custom PDF template in Plugin’ is closed to new replies.