WC_Webhook::__construct( WC_Webhook|int $data )
Load webhook data based on how WC_Webhook is called.
Description Description
Parameters Parameters
- $data
 - 
					
(Required) Webhook ID or data.
 
Source Source
File: includes/class-wc-webhook.php
	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 );
		}
	}