WordPress at Your Fingertips
function is not described

WC_Customer_Download_Data_Store::create() public WC 1.0

Create download permission for a user.

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

Return

null. Nothing.

Usage

$WC_Customer_Download_Data_Store = new WC_Customer_Download_Data_Store();
$WC_Customer_Download_Data_Store->create( $download );
$download(WC_Customer_Download) (required) (passed by reference — &)
WC_Customer_Download object.

Code of WC_Customer_Download_Data_Store::create() WC 5.8.0

public function create( &$download ) {
	global $wpdb;

	// Always set a access granted date.
	if ( is_null( $download->get_access_granted( 'edit' ) ) ) {
		$download->set_access_granted( time() );
	}

	$data = array();
	foreach ( self::DOWNLOAD_PERMISSION_DB_FIELDS as $db_field_name ) {
		$value                  = call_user_func( array( $download, 'get_' . $db_field_name ), 'edit' );
		$data[ $db_field_name ] = $value;
	}

	$inserted_id = $this->insert_new_download_permission( $data );
	if ( $inserted_id ) {
		$download->set_id( $inserted_id );
		$download->apply_changes();
	}

	do_action( 'woocommerce_grant_product_download_access', $data );
}