WooCommerce Code Reference

WC_Customer_Download_Data_Store
in package
implements WC_Customer_Download_Data_Store_Interface

WC Customer Download Data Store.

Tags
version
3.0.0

Interfaces, Classes and Traits

WC_Customer_Download_Data_Store_Interface
Customer Download Data Store Interface

Table of Contents

create()  : mixed
Create download permission for a user.
delete()  : mixed
Method to delete a download permission from the database.
delete_by_download_id()  : mixed
Method to delete a download permission from the database by download ID.
delete_by_id()  : mixed
Method to delete a download permission from the database by ID.
delete_by_order_id()  : mixed
Method to delete a download permission from the database by order ID.
delete_by_user_email()  : bool
Method to delete a download permission from the database by user email.
delete_by_user_id()  : bool
Method to delete a download permission from the database by user ID.
get_downloads()  : array
Get array of download ids by specified args.
get_downloads_for_customer()  : array
Get a customers downloads.
read()  : mixed
Method to read a download permission from the database.
update()  : mixed
Method to update a download in the database.
update_download_id()  : mixed
Update download ids if the hash changes.
update_user_by_order_id()  : mixed
Update user prop for downloads based on order id.
get_download()  : WC_Customer_Download
Get a download object.

Methods

delete_by_user_email()

Method to delete a download permission from the database by user email.

public delete_by_user_email(string $email) : bool
Parameters
$email : string

email of the downloads that will be deleted.

Tags
since
3.4.0
Return values
boolTrue if deleted rows.

delete_by_user_id()

Method to delete a download permission from the database by user ID.

public delete_by_user_id(int $id) : bool
Parameters
$id : int

user ID of the downloads that will be deleted.

Tags
since
3.4.0
Return values
boolTrue if deleted rows.

get_downloads()

Get array of download ids by specified args.

public get_downloads([array $args = array() ]) : array
Parameters
$args : array = array()

Arguments to filter downloads. $args['return'] accepts the following values: 'objects' (default), 'ids' or a comma separeted list of fields (for example: 'order_id,user_id,user_email').

Return values
arrayCan be an array of permission_ids, an array of WC_Customer_Download objects or an array of arrays containing specified fields depending on the value of $args['return'].

update_download_id()

Update download ids if the hash changes.

public update_download_id(int $product_id, string $old_id, string $new_id) : mixed
Parameters
$product_id : int

Product ID.

$old_id : string

Old download_id.

$new_id : string

New download_id.

Tags
deprecated
3.3.0

Download id is now a static UUID and should not be changed based on file hash.

Return values
mixed

update_user_by_order_id()

Update user prop for downloads based on order id.

public update_user_by_order_id(int $order_id, int $customer_id, string $email) : mixed
Parameters
$order_id : int

Order ID.

$customer_id : int

Customer ID.

$email : string

Customer email address.

Return values
mixed