Skip to content

Instantly share code, notes, and snippets.

Created September 8, 2015 19:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/01261f48dbbe28c53840 to your computer and use it in GitHub Desktop.
Save anonymous/01261f48dbbe28c53840 to your computer and use it in GitHub Desktop.
Show WC Vendor Custom Fields in front end
add_action( 'woocommerce_before_my_account','function_to_show_data');
function function_to_show_data(){
if (current_user_can('vendor')) {
$user_id = wp_get_current_user_id();
$vendor_account_name = get_user_meta( $user_id, ‘pv_account_name’ , true);
$vendor_account_number = get_user_meta( $user_id, ‘pv_bank_account_number’ , true); ?>
<p class="myaccount_user">
<?php
_e( 'Hey there!!!!', 'wc_product_vendor' );
_e( 'Your Account Name: '.$vendor_account_name.'</br> Your Account Number: '.$vendor_account_number.'</br>' , 'wc_product_vendor' );
?>
</p>
<?php } else {
_e( 'You don\'t have a vendor account', 'wc_product_vendor' );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment