Last active
January 28, 2021 11:02
-
-
Save zorem/5c60d11e6ae7654847a2af6a66d841f8 to your computer and use it in GitHub Desktop.
This is where we will hook into the WooCommerce emails and define the absolute path to the theme folder.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Class My_Custom_Status_WC_Email | |
*/ | |
class Delivered_WC_Email { | |
/** | |
* Delivered_WC_Email constructor. | |
*/ | |
public function __construct() { | |
// Filtering the emails and adding our own email. | |
add_filter( 'woocommerce_email_classes', array( $this, 'register_email' ), 90, 1 ); | |
// Absolute path to the plugin folder. | |
define( 'DELIVERED_WC_EMAIL_PATH', get_stylesheet_directory() ); | |
} | |
/** | |
* @param array $emails | |
* | |
* @return array | |
*/ | |
public function register_email( $emails ) { | |
require_once 'emails/class-wc-delivered-status-order.php'; | |
$emails['WC_Delivered_status_Order'] = new WC_Delivered_status_Order(); | |
return $emails; | |
} | |
} | |
new Delivered_WC_Email(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment