Home / Archive / MemebrPress: Send Membership-Specific Welcome Email Only When Transaction Is Completed
Duplicate Snippet

Embed Snippet on Your Site

MemebrPress: Send Membership-Specific Welcome Email Only When Transaction Is Completed

The code snippet will allow the membership-specific welcome email to be triggered only following the successful completion of a transaction in MemberPress. The membership-specific welcome emails can be set by editing a membership and enabling the Send Membership-Specific Welcome Email to User option under Membership Options > Registration tab.

Code Preview
php
<?php
function send_welcome_email_on_transaction_completed($event) {
    $txn = $event->get_data(); // Get the transaction data
    $usr = $txn->user(); // Get the user associated with the transaction
    MeprUtils::maybe_send_product_welcome_notices($txn, $usr); // Send the membership-specific welcome email
}
add_action('mepr-event-transaction-completed', 'send_welcome_email_on_transaction_completed');

Comments

Add a Comment