Forked from andrewlimaza/add-tax-pmpro-emails.php
Last active
March 16, 2021 09:48
-
-
Save JarrydLong/e7a8bde19be295b4e0549992f3040ba2 to your computer and use it in GitHub Desktop.
Add !!tax!! variable for Paid Memberships Pro email templates
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 | |
/** | |
* Adds an email variable !!tax!! to Paid Memberships Pro emails. | |
* Use the Email Templates Admin Editor to add !!tax!! to your email templates. | |
* Follow this guide to add this code to your site: https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
* | |
* Difficulty: Easy | |
*/ | |
function my_pmpro_email_variable( $data, $email ) { | |
$order = new MemberOrder( $data['invoice_id'] ); | |
$data['tax'] = get_user_meta( $order->user_id, 'tax_number', true ); | |
return $data; | |
} | |
add_filter( 'pmpro_email_data', 'my_pmpro_email_variable', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment