• Resolved HileciyizNET

    (@oyunmarketorg)


    Hi

    First sorry for my bad English.

    Dokan Registration page : ” I am a vendor” and “I am a customer”

    I want to “I am a Vendor” button is default checked.

    or

    Remove “I am a Customer” button and register only “vendor”.

    so ; Anyone registered, take the role of vendor(seller). Delete the customer role completely.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hello @oyunmarketorg,

    Thanks for your query. To open I am a vendor by default, you may need to change on the plugin file. Kindly open dokan-lite/includes/template-tags.php file and check the function dokan_seller_reg_form_fields. You will see this line on line number 553- $role = isset( $postdata['role'] ) ? $postdata['role'] : 'customer'; and now you have to just replace the line with this line $role = isset( $postdata['role'] ) ? $postdata['role'] : 'seller';. If you want to do this via child theme then you can add the below code on your child-theme functions.php file –
    remove_action( 'woocommerce_register_form', 'dokan_seller_reg_form_fields' );
    add_action( 'woocommerce_register_form', 'dokan_seller_reg_form_fields_modified',11 );

    function dokan_seller_reg_form_fields_modified() {
        $postdata = wc_clean( $_POST ); // WPCS: CSRF ok, input var ok.
        $role = isset( $postdata['role'] ) ? $postdata['role'] : 'seller';
        $role_style = ( $role == 'customer' ) ? 'display:none' : '';
    
        dokan_get_template_part( 'global/seller-registration-form', '', array(
            'postdata' => $postdata,
            'role' => $role,
            'role_style' => $role_style
        ) );
    }

    I hope that will solve your problem 🙂

    Thread Starter HileciyizNET

    (@oyunmarketorg)

    Thank you for your answer 🙂

    I did what you said.

    It was like in the screenshot.
    https://www.imagevisit.com/images/2019/12/15/11.png

    Vendor form appears but passive.

    Hello @oyunmarketorg,

    I am not seeing anything wrong because all the required fields for vendor registration forms are there. If you open it by default then all the fields for the form will show.

    Thread Starter HileciyizNET

    (@oyunmarketorg)

    I can see the form, but I can’t click it. The fields to be filled are dark. not clicked.

    https://www.imagevisit.com/images/2019/12/15/11.png

    Hello @oyunmarketorg,

    That might be a separate problem. The code I wrote was for selecting I am a vendor by default. You can fill our website contact form so that we can check.

    Thread Starter HileciyizNET

    (@oyunmarketorg)

    I sent a message on wedevs.com contact form

    Thread Starter HileciyizNET

    (@oyunmarketorg)

    Hey @nazmulhassann20
    I solved it!

    Step 1)
    /wp-content/plugins/dokan-lite/includes -> template-tags.php open and edit;

    Line 551:

    function dokan_seller_reg_form_fields() {
        $postdata = wc_clean( $_POST ); // WPCS: CSRF ok, input var ok.
        $role = isset( $postdata['role'] ) ? $postdata['role'] : 'customer';
        $role_style = ( $role == 'customer' ) ? 'display:none' : '';
    
        dokan_get_template_part( 'global/seller-registration-form', '', array(
            'postdata' => $postdata,
            'role' => $role,
            'role_style' => $role_style
        ) );
    }

    Replace with:

    function dokan_seller_reg_form_fields() {
        $postdata = wc_clean( $_POST ); // WPCS: CSRF ok, input var ok.
        $role = isset( $postdata['role'] ) ? $postdata['role'] : 'seller';
        $role_style = ( $role == 'customer' ) ? 'display:none' : '';
    
        dokan_get_template_part( 'global/seller-registration-form', '', array(
            'postdata' => $postdata,
            'role' => $role,
            'role_style' => $role_style
        ) );
    }

    Step 2)
    /wp-content/plugins/dokan-lite/assets/js -> vendor-registration.js open and edit;

    Line 170:

    $(function() {
        Dokan_Vendor_Registration.init();
    
        $('.show_if_seller').find( 'input, select' ).attr( 'disabled', 'disabled' );

    Replace With:

    $(function() {
        Dokan_Vendor_Registration.init();
    
        //$('.show_if_seller').find( 'input, select' ).attr( 'disabled', 'disabled' );

    Save and default user role is VENDOR 🙂

    (optional)
    To remove the “I am a customer” button;
    /wp-content/plugins/dokan-lite/templates/global -> seller-registration-form.php open and edit:

    <p class="form-row form-group user-role">
    	<label class="radio">
            <input type="radio" name="role" value="seller"<?php checked( $role, 'seller' ); ?>>
            <?php esc_html_e( 'I am a vendor', 'dokan-lite' ); ?>
        </label>
    	
    	<label class="radio">
            <input type="radio" name="role" value="customer"<?php checked( $role, 'customer' ); ?>>
            <?php esc_html_e( 'I am a customer', 'dokan-lite' ); ?>
        </label>
    	
        <?php do_action( 'dokan_registration_form_role', $role ); ?>
    </p>

    Replace With:

    <p class="form-row form-group user-role">
    	<label class="radio">
            <input type="radio" name="role" value="seller"<?php checked( $role, 'seller' ); ?>>
            <?php esc_html_e( 'I am a vendor', 'dokan-lite' ); ?>
        </label>
    	<!--
    	<label class="radio">
            <input type="radio" name="role" value="customer"<?php checked( $role, 'customer' ); ?>>
            <?php esc_html_e( 'I am a customer', 'dokan-lite' ); ?>
        </label>
    	-->
        <?php do_action( 'dokan_registration_form_role', $role ); ?>
    </p>
    • This reply was modified 4 years, 4 months ago by HileciyizNET.
    • This reply was modified 4 years, 4 months ago by HileciyizNET.
    • This reply was modified 4 years, 4 months ago by HileciyizNET. Reason: final
    • This reply was modified 4 years, 4 months ago by HileciyizNET.
    • This reply was modified 4 years, 4 months ago by HileciyizNET.

    Hello,

    Great! this would be handy for others 🙂

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Dokan Registration Radio Button “Default Vendor(Seller)”’ is closed to new replies.