Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.