Skip to content

Commit

Permalink
Merge pull request #2070 from angelleye/PFWMA-314-email-for-pay-pal-o…
Browse files Browse the repository at this point in the history
…nboard-seller-invitation-cannot-be-changed-customized

PFWMA-314 Resolved the issue of email template override
  • Loading branch information
kcppdevelopers authored Aug 23, 2024
2 parents 89943aa + a9da9b2 commit b3db65f
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions angelleye-includes/angelleye-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,28 @@ function ae_is_active_screen(string $screen): bool
return $screen_id == $screen;
}
}

if( !function_exists( 'ae_override_paypal_email_template') ) {
function ae_override_paypal_email_template($template, $template_name, $template_path) {
$basename = basename($template_name);

error_log('Base Name: ' . $basename);

if ($basename === 'angelleye-paypal-seller-onboard-invitation.php') {
// Check the theme directory first
$theme_template = get_stylesheet_directory() . '/woocommerce/emails/' . $basename;

error_log('Template: ' . $theme_template);

error_log("Exists: " . file_exists( $theme_template ) );

if (file_exists($theme_template)) {
return $theme_template;
}
}

return $template;
}

add_filter('woocommerce_locate_template', 'ae_override_paypal_email_template', 99999, 3);
}

0 comments on commit b3db65f

Please sign in to comment.