Hello @pablostradingco You can use the below code to create customer role again, paste the below code in the theme’s functions.php
/**
* This function is used to create another user role
*
* @name create_customer_user_role
* @since 1.0.0
* @author Mohit Mishra
* @link https://makewebbetter.com
*/
function create_customer_user_role() {
$mwb_create_user_role = get_option( 'created_customer_user_role' , false );
if ( empty( $mwb_create_user_role ) ) {
// Customer role.
add_role(
'customer',
'Customer',
array(
'read' => true,
)
);
update_option( 'created_customer_user_role' , true );
}
}
add_action( 'wp_loaded', 'create_customer_user_role' );
-
This reply was modified 6 years, 4 months ago by
Mohit Mishra.
@mohitmishra
Hi, I deleted both Customer AND Shop Manager user roles by mistake – I have used your awesome code from this post to restore the Customer role and it worked perfectly! 😀
I now desperately need to restore the Shop Manager role as well – could you please provide me the correct code with default WooCommerce Shop Manager capabilities included?
Any help would be really appreciated.
Many thanks
Hi all!
User Role Editor has a guide here on how to restore deleted roles – https://www.role-editor.com/how-to-restore-deleted-wordpress-user-roles/
In short, just deactivating and reactivating WooCommerce will restore the user roles from WooCommerce that was removed
We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.