Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save IanMisnerThough/70c44172af4791d688a3cd57aefb54b0 to your computer and use it in GitHub Desktop.

Select an option

Save IanMisnerThough/70c44172af4791d688a3cd57aefb54b0 to your computer and use it in GitHub Desktop.
/**
* Make the Team Name field on the product page Required
* Requires Teams 1.0.2
*
* @param array $fields the product page fields
* @param \WC_Product $product current product, unused
* @return array updated fields
*/
add_filter( 'wc_memberships_for_teams_product_team_user_input_fields', function( $fields, $product ) {
if ( isset( $fields['team_name'] ) ) {
$fields['team_name']['custom_attributes'] = array( 'required' => 'required' );
}
return $fields;
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment