Suma Woo Emails
Location: web/app/plugins/suma-woo-emails/
Author: Rhino Group
Plugin Header: Plugin Name: Suma Woo Emails
Overviewโ
The suma-woo-emails plugin registers 6 custom WooCommerce email types that cover the specific order lifecycle events of a precious metals store โ events that the default WooCommerce email set does not support.
All email classes extend the standard WC_Email class and integrate fully with WooCommerce's email management system (WooCommerce โ Settings โ Emails).
File Structureโ
suma-woo-emails/
โโโ suma-woo-emails.php โ Main plugin file / bootstrap
โโโ emails/
โ โโโ class-wc-customer-pending-payment-order.php
โ โโโ class-wc-customer-cancelled-for-fraud-order.php
โ โโโ class-wc-customer-cancelled-bwt-email.php
โ โโโ class-wc-customer-bank-wire-complete-email.php
โ โโโ class-wc-admin-vault-order.php
โ โโโ class-wc-admin-solana-pending-payment.php
โโโ templates/
โโโ emails/
โโโ plain/ โ Plain text versions
โ โโโ wc-customer-pending-payment-order.php
โ โโโ wc-customer-cancelled-for-fraud-order.php
โ โโโ wc-customer-cancelled-bwt-email.php
โ โโโ wc-customer-bank-wire-complete-email.php
โ โโโ wc-admin-vault-order.php
โ โโโ wc-admin-solana-pending-payment.php
โโโ wc-customer-pending-payment-order.php
โโโ wc-customer-cancelled-for-fraud-order.php
โโโ wc-customer-cancelled-bwt-email.php
โโโ wc-customer-bank-wire-complete-email.php
โโโ wc-admin-vault-order.php
โโโ wc-admin-solana-pending-payment.php
Main Plugin Class: Custom_WC_Emailโ
File: suma-woo-emails.php
This class acts as the plugin orchestrator. It:
- Registers all 6 custom email classes with WooCommerce via the
woocommerce_email_classeshook - Hooks into order status changes to trigger the appropriate emails
- Triggers bank wire complete emails on the standard
woocommerce_order_status_processinghook
class Custom_WC_Email {
public function __construct() {
add_filter( 'woocommerce_email_classes', [ $this, 'register_email' ], 90 );
add_action( 'woocommerce_thankyou', [ $this, 'send_notices' ], 50 );
add_action( 'woocommerce_order_status_processing', [ $this, 'trigger_bank_wire_complete_email' ], 10 );
}
}
Custom Email Classesโ
1. WC_Customer_Pending_Payment_Orderโ
| Property | Value |
|---|---|
| File | emails/class-wc-customer-pending-payment-order.php |
| Email ID | wc_customer_pending_payment_order |
| Title | "Pending Payment ACH to Customer" |
| Recipient | Customer |
| Trigger | Order status changes to wc-pending-ach |
| Payment methods | wc_itransact, scottsdale-ach-gateway |
Purpose: Notifies the customer that their ACH bank transfer has been initiated and is pending processing. Includes instructions about expected timelines and what to expect.
2. WC_Customer_Cancelled_For_Fraud_Orderโ
| Property | Value |
|---|---|
| File | emails/class-wc-customer-cancelled-for-fraud-order.php |
| Recipient | Customer |
| Trigger | Order cancelled (Kount fraud decision: Decline) |
Purpose: Notifies the customer their order was cancelled due to a security review. Email is intentionally vague about fraud detection to avoid giving fraudsters information.
This email is triggered by the Kount ENS handler when a fraud decision returns "Decline". Do not trigger this manually without verifying the order was actually flagged by Kount.
3. WC_Customer_Cancelled_BWT_Emailโ
| Property | Value |
|---|---|
| File | emails/class-wc-customer-cancelled-bwt-email.php |
| Recipient | Customer |
| Trigger | Order status changed, cancellation for bank wire transfer orders |
Purpose: Notifies the customer their bank wire transfer order was cancelled. May be triggered by admin when a bank wire is not received within the expected timeframe.
4. WC_Customer_Bank_Wire_Complete_Emailโ
| Property | Value |
|---|---|
| File | emails/class-wc-customer-bank-wire-complete-email.php |
| Recipient | Customer |
| Trigger | woocommerce_order_status_processing (only for bank wire orders) |
Purpose: Confirms to the customer that their bank wire/ACH payment has been received and the order is now being processed.
The trigger_bank_wire_complete_email() method checks the order's payment method before sending โ this email only fires for applicable gateway IDs.
5. WC_Admin_Vault_Orderโ
| Property | Value |
|---|---|
| File | emails/class-wc-admin-vault-order.php |
| Email ID | (admin-only) |
| Title | "Vault Notice to Admin" |
| Recipient | Store admin email |
| Trigger | Vault/tokenization order placed |
Purpose: Notifies store administrators when an order involves vault storage (customer is storing metals at the Scottsdale Mint facility rather than taking physical delivery). Includes order details and vault instructions.
6. WC_Admin_Solana_Pending_Paymentโ
| Property | Value |
|---|---|
| File | emails/class-wc-admin-solana-pending-payment.php |
| Recipient | Store admin email |
| Trigger | Solana (SOL) cryptocurrency payment initiated |
Purpose: Notifies admins when a Solana payment is pending blockchain confirmation. Solana can have variable confirmation times depending on network conditions.
WordPress Hooksโ
| Hook | Method | Priority | Description |
|---|---|---|---|
woocommerce_email_classes (filter) | register_email() | 90 | Registers all 6 custom email classes with WooCommerce |
woocommerce_thankyou (action) | send_notices() | 50 | Fires on the thank you page to trigger relevant notices |
woocommerce_order_status_processing (action) | trigger_bank_wire_complete_email() | 10 | Triggers bank wire complete email when order moves to processing |
woocommerce_order_status_changed (action) | trigger() (in BWT email class) | 10 | Monitors all status changes for BWT cancellation |
Email Templatesโ
Each email has both HTML and plain text versions:
- HTML:
templates/emails/{email-slug}.php - Plain text:
templates/emails/plain/{email-slug}.php
Templates use standard WooCommerce email template conventions and can be overridden by placing a copy in the active theme's woocommerce/emails/ directory.
WooCommerce Settings Integrationโ
All 6 email types appear in WooCommerce โ Settings โ Emails and support the standard configuration options:
- Enable/Disable the email
- Set custom subject line
- Set custom email heading
- Set recipient(s) (for admin emails)
- Preview email template
Adding a New Custom Emailโ
To add a new custom WooCommerce email:
- Create
emails/class-wc-{your-email-slug}.phpextendingWC_Email - Create
templates/emails/{your-email-slug}.php(HTML template) - Create
templates/emails/plain/{your-email-slug}.php(plain text template) - Register the class in
Custom_WC_Email::register_email():
public function register_email( array $email_classes ) : array {
$email_classes['WC_Your_New_Email'] = new WC_Your_New_Email();
return $email_classes;
}
- Add the trigger hook in the constructor or
Custom_WC_Email