WC_Order::set_billing_email PHP Method

set_billing_email() public method

Set billing_email.
public set_billing_email ( string $value )
$value string
    public function set_billing_email($value)
    {
        if ($value && !is_email($value)) {
            $this->error('order_invalid_billing_email', __('Invalid billing email address', 'woocommerce'));
        }
        $this->set_address_prop('email', 'billing', sanitize_email($value));
    }

Usage Example

示例#1
0
 /**
  * Test: get_billing_email
  */
 function test_get_billing_email()
 {
     $object = new WC_Order();
     $set_to = '*****@*****.**';
     $object->set_billing_email($set_to);
     $this->assertEquals($set_to, $object->get_billing_email());
     $set_to = 'not an email';
     $this->setExpectedException('WC_Data_Exception');
     $object->set_billing_email($set_to);
     $this->assertEquals('*****@*****.**', $object->get_billing_email());
 }
All Usage Examples Of WC_Order::set_billing_email
WC_Order