WordPress at Your Fingertips
function is not described

WC_Webhook::__construct() public WC 1.0

Load webhook data based on how WC_Webhook is called.

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

No Hooks.

Return

null. Nothing.

Usage

$WC_Webhook = new WC_Webhook();
$WC_Webhook->__construct( $data );
$data(WC_Webhook|int)
Webhook ID or data.

Code of WC_Webhook::__construct() WC 5.9.0

public function __construct( $data = 0 ) {
	parent::__construct( $data );

	if ( $data instanceof WC_Webhook ) {
		$this->set_id( absint( $data->get_id() ) );
	} elseif ( is_numeric( $data ) ) {
		$this->set_id( $data );
	}

	$this->data_store = WC_Data_Store::load( 'webhook' );

	// If we have an ID, load the webhook from the DB.
	if ( $this->get_id() ) {
		try {
			$this->data_store->read( $this );
		} catch ( Exception $e ) {
			$this->set_id( 0 );
			$this->set_object_read( true );
		}
	} else {
		$this->set_object_read( true );
	}
}