Forked from andrewlimaza/woocommerce_billing_fields_pmpro_invoice.php
Last active
March 26, 2021 12:06
-
-
Save travislima/bc5e5c2b32ce9cd41de8584a0eee6f50 to your computer and use it in GitHub Desktop.
Add WooCommerce billing fields to Paid Memberships Pro Invoice
This file contains 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 WooCommerce billing fields to Paid Memberships Pro invoices. | |
* Follow this guide to add this code to your site - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function add_woocommerce_billing_fields_to_pmpro_invoice() { | |
global $current_user; | |
// Personal details from billing details WooCommerce. | |
$company = get_user_meta( $current_user->ID, 'billing_company', true ); | |
$fname = get_user_meta( $current_user->ID, 'billing_first_name', true ); | |
$lname = get_user_meta( $current_user->ID, 'billing_last_name', true ); | |
$phone = get_user_meta( $current_user->ID, 'billing_phone', true ); | |
// Address details from billing details WooCommerce. | |
$address_1 = get_user_meta( $current_user->ID, 'billing_address_1', true ); | |
$address_2 = get_user_meta( $current_user->ID, 'billing_address_2', true ); | |
$city = get_user_meta( $current_user->ID, 'billing_city', true ); | |
$state = get_user_meta( $current_user->ID, 'billing_state', true ); | |
$postcode = get_user_meta( $current_user->ID, 'billing_postcode', true ); | |
$country = get_user_meta( $current_user->ID, 'billing_country', true ); | |
echo '<li><strong>Company:</strong> ' . $company . '</li>'; | |
echo '<li><strong>Full Name:</strong> ' . $fname . ' ' . $lname . '</li>'; | |
echo '<li><strong>Phone:</strong> ' . $phone . '</li>'; | |
echo '<li><strong>Address:</strong><br/>' . $address_1 . '<br/>'; | |
echo $address_2 . '<br/>'; | |
echo $city . '<br/>'; | |
echo $state . '<br/>'; | |
echo $postcode . '<br/>'; | |
echo $country . '</li>'; | |
} | |
add_action( 'pmpro_invoice_bullets_bottom', 'add_woocommerce_billing_fields_to_pmpro_invoice' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment