WC_Email::move_template_action( string $template_type )
Move template action.
Description Description
Parameters Parameters
- $template_type
-
(Required) Template type.
Source Source
File: includes/emails/class-wc-email.php
protected function move_template_action( $template_type ) {
$template = $this->get_template( $template_type );
if ( ! empty( $template ) ) {
$theme_file = $this->get_theme_template_file( $template );
if ( wp_mkdir_p( dirname( $theme_file ) ) && ! file_exists( $theme_file ) ) {
// Locate template file.
$core_file = $this->template_base . $template;
$template_file = apply_filters( 'woocommerce_locate_core_template', $core_file, $template, $this->template_base, $this->id );
// Copy template file.
copy( $template_file, $theme_file );
/**
* Action hook fired after copying email template file.
*
* @param string $template_type The copied template type
* @param string $email The email object
*/
do_action( 'woocommerce_copy_email_template', $template_type, $this );
?>
<div class="updated">
<p><?php echo esc_html__( 'Template file copied to theme.', 'woocommerce' ); ?></p>
</div>
<?php
}
}
}