• Resolved Miguelonx

    (@miguelonx)


    Hi,
    I would like to know how to change the default ROL assigned by Woocommerce which is from Customer to Subscriber when registering or purchasing a product.
    Thanks,

    • This topic was modified 2 years, 5 months ago by Miguelonx.
Viewing 6 replies - 1 through 6 (of 6 total)
  • hi @miguelonx ,

    I don’t think there is option for that. You have to get your hands dirty and code your way through that.

    Hi, nothing to hard code.
    In your WordPress Dashboard go to Settings, click the first Submenu (in my German version its “allgemein”, so maybe in english it is common or something similar) and ther you can find an dropdown standard role of new user. Change it to you likings. By default if woo is installed it is customer.

    Thread Starter Miguelonx

    (@miguelonx)

    Hi @gerold1968
    Thank you very much for your reply.
    I have made the change as you indicated to the Subscriber ROLE but when I do a test to finish the purchase it generates the Customer ROLE ??
    https://prnt.sc/5AHjubVDClyg
    Can you tell me if I can do any more steps to change it?
    I am using Elementor for the design of the checkout page.
    Thanks,

    • This reply was modified 2 years, 5 months ago by Miguelonx.
    • This reply was modified 2 years, 5 months ago by Miguelonx.
    • This reply was modified 2 years, 5 months ago by Miguelonx.
    Thread Starter Miguelonx

    (@miguelonx)

    Hi @vaibhav26 ,
    Do you know of any code that might work for what I need?
    Thanks,

    • This reply was modified 2 years, 5 months ago by Miguelonx.
    Plugin Support ricardometring

    (@ricardoa8c)

    Hi there,

    You may use the following filter to create WooCommerce users with a “Subscriber” role.

    This code can be added yo your website using a plugin such as Code snippets.

    add_filter( 'woocommerce_new_customer_data', 'woocommerce_new_customer_data_set_role' );
    
    /**
     * Function for woocommerce_new_customer_data filter hook.
     * 
     * @param array $customer_data An array of customer data.
     *
     * @return array
     */
    function woocommerce_new_customer_data_set_role( $customer_data ){
    	$customer_data['role'] = 'subscriber';
    	return $customer_data;
    }

    Note: Roles are used to determine what type of access a user should have across the website. Changing a user role may impact their experience with WooCommerce and/or third-party plugins. Test this on a staging site before applying the code to a production environment.

    Thread Starter Miguelonx

    (@miguelonx)

    Hi @ricardoa8c !
    Thanks for you reply.
    I will try the code you send me to see if I can solve my problem.
    Best regards!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to change the default ROLE of Woocommerce’ is closed to new replies.