Skip to content

Instantly share code, notes, and snippets.

@kloon
Created April 10, 2013 12:58
Show Gist options
  • Select an option

  • Save kloon/5354377 to your computer and use it in GitHub Desktop.

Select an option

Save kloon/5354377 to your computer and use it in GitHub Desktop.
WooCommerce Software Licences on My Account page
<?php
add_action( 'woocommerce_before_my_account', 'woocommerce_customer_licenses_my_account' );
function woocommerce_customer_licenses_my_account() {
global $wpdb;
$current_user = wp_get_current_user();
$licence_keys = $wpdb->get_results(
$wpdb->prepare(
"
SELECT * FROM {$wpdb->prefix}woocommerce_software_licences
WHERE activation_email = %s
",
$current_user->user_email
)
);
echo "<h2>Software Licenses</h2>";
foreach ( $licence_keys as $license_key ) {
echo $license_key->licence_key;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment