on woocommerce account page trying hide couple of sections based on user role.
at moment, people register directly woocommerce registration form assigned user role 'customer'. however, users role 'employer' able make purchases... want hide addresses section users 'customers'.
any ideas if can function? miro
this possible templates. add function in functions.php file can reuse it:
function isemployer(){ $currentuser = wp_get_current_user(); return in_array('employer', $currentuser->roles); } grab my-account.php template woocommerce > templates > myaccount , copy on theme's woocommerce directory (yourtheme > woocommerce > myaccount).
from there go line 36. address gets loaded in.
wrap address php if statement so:
<?php if( isemployer() ){ wc_get_template( 'myaccount/my-address.php' ) }?>
Comments
Post a Comment