Emails Invoices And Notifications

Email Templates

Template classes include:

OrderPaidReceipt
RefundReceipt
PaymentFailed
SoftwareLicenseKeys
SubscriptionWelcome
SubscriptionRenewed
SubscriptionCancelled
TrialEnding
InvoiceIssued
DunningFirstAttempt
DunningFinalNotice
DunningRecovered

Filter Email Message

add_filter('awecommerce_email_message', function ($message) {
    return $message;
});

Override Email Send

add_filter('awecommerce_email_send', function ($override, $message, array $headers) {
    if ($override !== null) {
        return $override;
    }

    // Send through an external provider here.
    return null;
}, 10, 3);

Filter Layout

add_filter('awecommerce_email_layout', function ($html, $body_html, $settings) {
    return str_replace('</body>', '<p>Custom footer</p></body>', $html);
}, 10, 3);

Invoice Download Routes

GET /wp-json/awecommerce/v1/portal/invoices
GET /wp-json/awecommerce/v1/portal/invoices/{id}
GET /wp-json/awecommerce/v1/portal/invoices/{id}/download?format=pdf
GET /wp-json/awecommerce/v1/portal/invoices/{id}/download?format=html
GET /wp-json/awecommerce/v1/admin/invoices/{id}/download?format=pdf
GET /wp-json/awecommerce/v1/admin/invoices/{id}/download?format=html

Notification Hook

add_action('awecommerce_notification_created', function ($notification) {
    error_log('Notification created: ' . $notification->id);
});

Create A Custom Notification Listener

add_action('awecommerce_payment_failed', function ($order) {
    error_log('Payment failed for order ' . $order->id);
});

Was this documentation helpful?