WordPress at Your Fingertips
function is not described

WC_Coupon::set_email_restrictions() public WC 3.0.0

Set email restrictions.

{} It's a method of the class: WC_Coupon{}

No Hooks.

Return

null. Nothing.

Usage

$WC_Coupon = new WC_Coupon();
$WC_Coupon->set_email_restrictions( $emails );
$emails(array)
List of emails.
Default: array()

Changelog

Since 3.0.0 Introduced.

Code of WC_Coupon::set_email_restrictions() WC 5.6.0

public function set_email_restrictions( $emails = array() ) {
	$emails = array_filter( array_map( 'sanitize_email', array_map( 'strtolower', (array) $emails ) ) );
	foreach ( $emails as $email ) {
		if ( ! is_email( $email ) ) {
			$this->error( 'coupon_invalid_email_address', __( 'Invalid email address restriction', 'woocommerce' ) );
		}
	}
	$this->set_prop( 'email_restrictions', $emails );
}