Skip to content

Instantly share code, notes, and snippets.

@julien731
Last active February 21, 2018 12:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save julien731/a519956ce9c81542439c to your computer and use it in GitHub Desktop.
Save julien731/a519956ce9c81542439c to your computer and use it in GitHub Desktop.
add_filter( 'wpas_get_custom_fields', 'wpas_make_product_required' );
/**
* Make the products field required
*
* @param array $custom_fields Registered custom fields
*
* @return array
*/
function wpas_make_product_required( $custom_fields ) {
if ( isset( $custom_fields['product'] ) ) {
$custom_fields['product']['args']['required'] = true;
}
return $custom_fields;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment