Created
October 19, 2020 07:00
-
-
Save andrewlimaza/9d2621b6fd921344fed8e85f129d7f3e to your computer and use it in GitHub Desktop.
Add !!invoice_subtotal!! and !!invoice_tax!! to email templates Paid Memberships Pro.
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 | |
/** | |
* This creates two variables !!invoice_subtotal!! and !!invoice_tax!! to email templates where the !!invoice_id!! is available. | |
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_add_invoice_details_to_email( $data, $email ) { | |
if ( isset( $data['invoice_id'] ) ) { | |
$invoice = new MemberOrder($data['invoice_id']); | |
$data['invoice_subtotal'] = isset( $invoice->subtotal ) ? pmpro_formatPrice( $invoice->subtotal ) : ''; | |
$data['invoice_tax'] = isset( $invoice->tax ) ? pmpro_formatPrice( $invoice->tax ) : ''; | |
} | |
return $data; | |
} | |
add_filter( 'pmpro_email_data', 'my_pmpro_add_invoice_details_to_email', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment