Skip to content

Instantly share code, notes, and snippets.

@digitalchild
Created January 26, 2016 06:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save digitalchild/0e1675371c4dcbe88deb to your computer and use it in GitHub Desktop.
Save digitalchild/0e1675371c4dcbe88deb to your computer and use it in GitHub Desktop.
How to make a field required in WC Vendors Pro
<?php
// The first thing you need to do is find the filter for the field you want to adjust the requirements
// You can find the filters in public/forms/class-wcvendors-pro-product-form.php
// You will need one of these for each field you'd like to make required.
function make_required_fieldname( $args ) {
$args[ 'custom_attributes' ] => array(
'data-rules' => 'required',
'data-error' => __( 'This field is required.', 'wcvendors-pro' )
);
}
// Using description as an example
add_filter( 'wcv_product_description, 'make_required_fieldname' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment