Created
August 18, 2016 07:29
-
-
Save yratof/a6cada2f14967a353ab24203d8d789e5 to your computer and use it in GitHub Desktop.
Add content to emails sent out by woocommerce
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 | |
add_action( 'woocommerce_email_before_order_table', __CLASS__ . '::before_order_email', 10, 4 ); | |
add_action( 'woocommerce_email_after_order_table', __CLASS__ . '::after_order_email', 10, 4 ); | |
// Add content before the order table | |
static function before_order_email( $order, $sent_to_admin, $plain_text, $email ) { | |
// If the emails links to the dashboard | |
if ( $sent_to_admin ) { | |
// email is plain text, not html | |
if ( ! $plain_text ) { | |
// HTML content here | |
} else { | |
// Plain text only | |
} | |
} | |
} | |
// Add content after the order table | |
static function after_order_email( $order, $sent_to_admin, $plain_text, $email ) { | |
// If the emails links to the dashboard | |
if ( $sent_to_admin ) { | |
// email is plain text, not html | |
if ( ! $plain_text ) { | |
// HTML content here | |
} else { | |
// Plain text only | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment