Home Forums WC Vendors Pro Support Make fields mandatory on vendor registration form

NOTICE: We've Moved to a Ticket System for Support

As of August 31, 2017 (12am EST) our support forums will be retired (read-only), and we will be moving to a support ticket system.  This will allow us to better organize and answer support requests, and provide a more personalized experience as we assist our customers.

For the time being, we will leave our forums open for reading and learning while we work on creating a more robust Knowledge Base for everyone to use.

If you are a WC Vendors Pro customer please open a support ticket here. 

If you are a WC Vendors user please open a support ticket on the Wordpress.org forums.

The information on this forum is outdated and in most instances no longer relevant. Please be sure to check our documentation for the most up to date information.

https://docs.wcvendors.com/

Thank you to all of our customers!

 

  • This topic has 20 replies, 7 voices, and was last updated 7 years ago by Anna.
Viewing 21 posts - 1 through 21 (of 21 total)
  • Author
    Posts
  • #19930
    Frandes Edmond
    Participant

    Hi guys ,
    I want to make the some fields from vendor registration mandatory. , like the adress and tel nr.
    Also i want to hide the country of the store , since it will be only one
    How can i change that ?
    Thank you
    Edmond

    #19942
    Karen Thomas
    Participant

    Following this one as I also need to make some fields mandatory on the registration form. I tested for a short period a while back and found that vendors were lazy and only filled in the first part ignoring the tabs for social, branding etc.

    Also would love to be able to make some fields ‘required’ on the product-edit form 🙂

    #19963
    WC Vendors Support
    Participant

    In v1.2.0 there will be an option/filter to require fields to be required. More on that after it’s released. 🙂

    #19988
    Karen Thomas
    Participant

    Woo hoo!!! 😀

    #35855
    Bo Congdon
    Participant

    Was this ever added to the plugin? I dont see options to make fields required only to hide.

    #35856
    Jamie
    Keymaster

    Hello,

    To make fields required you need to still use the filters. I have to re-write our settings API system to allow multiple check boxes so we can have ‘hide/show + required’

    cheers

    Jamie.

    #35857
    Bo Congdon
    Participant

    Thanks for the quick reply, I cant remember where you’re tutorial is about adding the filters. Would you point me in the right direction?

    #35858
    WC Vendors Support
    Participant

    https://www.wcvendors.com/kb/make-product-fields-required/ is the tutorial in our KnowledgeBase

    #35860
    Bo Congdon
    Participant

    ok, what file is vendor application form in? So that i can find the field names to add to the filters?

    #35916
    WC Vendors Support
    Participant

    /plugins/wc-vendors-pro/templates/front/vendor-signup-form.php is the signup form template!

    #35938
    Bo Congdon
    Participant

    I cant get it to work, for example i would like to make the paypal field required. The code in the template is as such

    <div class=”tabs-content” id=”payment”>
    <!– Paypal address –>
    <?php WCVendors_Pro_Store_Form::paypal_address( ); ?>
    </div>

    What will the filter look like?

    /* WC Vendors Pro – Make vendor form paypal Required */
    function WCVendors_Pro_Store_Form_required( $args ) {
    $args[ ‘custom_attributes’ ] = array(
    ‘data-rules’ => ‘required’, // Change ‘required’ to ” to make it not required (just remove the word required but keep the single quotes)
    ‘data-error’ => __( ‘This field is required.’, ‘wcvendors-pro’ )
    );
    return $args;
    }
    add_filter( ‘WCVendors_Pro_Store_Form’, ‘WCVendors_Pro_Store_Form_required’ );

    #36293
    WC Vendors Support
    Participant

    https://www.wcvendors.com/kb/make-product-fields-required/ — In the code shown here, all of the code goes in the themes functions.php file, not in the Pro vendor signup templates.

    #36297
    Bo Congdon
    Participant

    Yes i understand that, that is what i have done. That filter is what i added to the function.php file. Is that code correct?

    #36647
    WC Vendors Support
    Participant

    No, the code is incorrect. You’re not using the correct filter name, instead you’re using the class name which just wont do anything. Try something like this — Note that the correct filter name is wcv_vendor_paypal_address.

    function wcv_vendor_paypal_address_required( $args ) { 
        $args[ 'custom_attributes' ] = array( 
    	'data-rules' => 'required', // Change 'required' to '' to make it not required (just remove the word required but keep the single quotes)
    	'data-error' => __( 'This field is required.', 'wcvendors-pro' )
    	); 
        return $args; 
    } 
    add_filter( 'wcv_vendor_paypal_address', 'wcv_vendor_paypal_address_required' ); 
    #36664
    Bo Congdon
    Participant

    ahh, i dont mean to be such a pain. But i added your exact code to the function.php file in the theme i am using but it still isn’t required …

    #36800
    Jamie
    Keymaster

    Hello,

    Are you overriding any template files at all? Please ensure you are running the latest copy of all templates or overrides. I have tested the code that Ben has provided and it is working on 2 different installs. You need to ensure that the form has a class of wcv-formvalidator otherwise our form validation code doesn’t run.

    cheers,

    Jamie.

    #36908
    Bo Congdon
    Participant

    Yes i am overriding the vendor-signup-form.php template. I have it in theme/wcvendpor folder. Where in the template does the class wcv-formvalidator need to go?

    #36946
    WC Vendors Support
    Participant

    Copy the latest template over, or rename your template override, and see if it works.

    #37004
    Bo Congdon
    Participant

    I renamed it, it then showed the original vendor application however it still didn’t work….. This is really starting to get frustrating when all i am trying to do is a simple task as make a field required.

    #59007
    Aaron Roessler
    Participant

    The *required paypal code you provided above works great… but the only issue is that if they are on the Store Tab section and click the Apply To Be Vendor button on that tab page nothing happens… no error or anything. The person would only know that that the paypal field is required if they click the Payment Tab to see the error message “THIS FIELD IS REQUIRED. YOUR PAYPAL ADDRESS IS USED TO SEND YOU YOUR COMMISSION”

    #59077
    Anna
    Member

    You can also edit the product-edit.php template so that a vendor is prevented form listing a product until the paypal email address is entered.
    Approx line 24, add:

    $value = get_user_meta( get_current_user_id(), 'pv_paypal', true );
    if ( !empty( $value ) ) {
    ?>

    So, if you do this, approx line 21-29 should look like this now:

    /**
     *  Ok, You can edit the template below but be careful!
    */
    $value = get_user_meta( get_current_user_id(), 'pv_paypal', true );
    if ( !empty( $value ) ) {
    ?>
    <h2><?php echo $title; ?></h2>
    
    <!-- Product Edit Form -->

    Now go to the very end of the template. Approx line 208 after </form> add this:

    <?php
    } else {
    echo '<p> WAIT!  Before you can add products, you need to enter your paypal email address, so you can receive the funds from your sales. Please <a href="/pro-dashboard/settings/"> VISIT YOUR STORE DASHBOARD SETTINGS </a> and click the PAYMENTS tab.</p>';
    }
    ?>

    Check that the URL in the error message there is accurate for your website’s pro dashboard > settings page.

Viewing 21 posts - 1 through 21 (of 21 total)
  • The forum ‘WC Vendors Pro Support’ is closed to new topics and replies.