### Product Price and SKU Examples Source: https://easydigitaldownloads.com/docs/importing-exporting-products.md Examples of formatting for product price strings and SKU identifiers. ```text Monthly: 10.00 ``` ```text Monthly: 10.00 | Yearly: 120.00 ``` ```text AAMAM2016 ``` -------------------------------- ### HTML output examples for product dropdown attributes Source: https://easydigitaldownloads.com/docs/edd_html_elements.md Examples of how specific attributes like name, id, and class appear in the rendered HTML. ```html ``` ```html ``` ```html ``` -------------------------------- ### Product Slug Example Source: https://easydigitaldownloads.com/docs/importing-exporting-products.md Example of formatting for product slugs using a vertical bar separator. ```text Ebook | Marketing ``` -------------------------------- ### Custom License Key Format Example Source: https://easydigitaldownloads.com/docs/software-licensing-common-issues-and-faqs.md An example of a custom license key format using username, timestamp, and MD5 hash. ```text sdavis2702_20151015120022_e0c7ccc47b2613c82d1073a4214deecc ``` -------------------------------- ### HTML output examples for customer dropdown attributes Source: https://easydigitaldownloads.com/docs/edd_html_elements.md Examples of how specific attributes like name, id, and class appear in the rendered HTML for customer dropdowns. ```html ``` ```html ``` ```html ``` -------------------------------- ### Example cURL output Source: https://easydigitaldownloads.com/docs/software-licensing-api-example-using-curl.md The expected output when running the curl command if it is correctly installed. ```text curl: try 'curl --help' or 'curl --manual' for more information ``` -------------------------------- ### Example Campaign Organization Source: https://easydigitaldownloads.com/docs/tracking-marketing-campaigns.md Recommended UTM parameter structure for consistent campaign tracking. ```text utm_source=facebook utm_medium=social utm_campaign=fb_product_launch_2027_q1 utm_source=newsletter utm_medium=email utm_campaign=email_weekly_digest_2027_jan ``` -------------------------------- ### Sales Stats for All Products Query and Response Source: https://easydigitaldownloads.com/docs/edd-rest-api-stats.md Example of querying sales stats for all products. ```text https://yoursite.com/edd-api/stats/?key=c281cf0a95be875d9eeb284fb004c938&token=5f9432f3ffa5945755ebc66179810d70&type=sales&product=all ``` ```json { "sales": [ { "test-2": "6" }, { "simple-notices-pro": "48" }, { "love-it-pro": "13" }, { "test-product-2-2": "0" }, { "test-product-1-2": "0" } ] } ``` -------------------------------- ### wp edd details Source: https://easydigitaldownloads.com/docs/wp-cli-commands.md Provides a summary of the Easy Digital Downloads installation. ```APIDOC ## wp edd details ### Description Displays installation details including version number, key settings, and tax rates. ``` -------------------------------- ### GET /customers/ Source: https://easydigitaldownloads.com/docs/edd-rest-api-v2-customers.md Retrieves a list of customers from the shop. ```APIDOC ## GET /customers/ ### Description Retrieves a list of customers that have purchased items from your shop. ### Method GET ### Endpoint /edd-api/v2/customers/ ### Parameters #### Query Parameters - **key** (string) - Required - API key for authentication. - **token** (string) - Required - API token for authentication. - **number** (integer) - Optional - The number of customers to retrieve. - **date** (string) - Optional - The date to retrieve customers for (today, yesterday, or range). - **startdate** (string) - Optional - Start date for range query (YYYYMMDD). - **enddate** (string) - Optional - End date for range query (YYYYMMDD). ### Response #### Success Response (200) - **customer_id** (integer) - The unique ID of the customer. - **user_id** (integer) - The WordPress user ID. - **username** (string) - The WordPress user login name. - **display_name** (string) - The WordPress user display name. - **first_name** (string) - The customer first name. - **last_name** (string) - The customer last name. - **email** (string) - The customer's email address. - **date_created** (string) - The date this customer was created in EDD. - **total_purchases** (integer) - The total number of purchases the customer has made. - **total_spent** (float) - The total amount the customer has spent. - **total_downloads** (integer) - The total number of files the customer has downloaded. - **stats** (object) - Object containing the total number of customers in the database. ``` -------------------------------- ### Get download SKU Source: https://easydigitaldownloads.com/docs/edd_download.md Retrieves the SKU for a download. ```php $download_sku = $my_download->get_sku(); ``` -------------------------------- ### GET /discounts/ Source: https://easydigitaldownloads.com/docs/edd-rest-api-discounts.md Retrieves a list of discounts available in the store. ```APIDOC ## GET /discounts/ ### Description Retrieves a list of all discounts configured in the Easy Digital Downloads store. ### Method GET ### Endpoint /edd-api/discounts/ ### Parameters #### Query Parameters - **key** (string) - Required - The API key for authentication. - **token** (string) - Required - The API token for authentication. ### Response #### Success Response (200) - **discounts** (array) - A list of discount objects. - **request_speed** (float) - The time taken to process the request. #### Response Example { "discounts": [ { "ID": 158, "name": "Taco Tuesday", "code": "TACOTUESDAY", "amount": 5, "min_price": 0, "type": "flat", "uses": 0, "max_uses": 0, "start_date": "", "exp_date": "", "status": "inactive", "product_requirements": [114], "requirement_condition": "all", "global_discount": false, "single_use": false } ], "request_speed": 0.039878129959106 } ``` -------------------------------- ### Activate License Key Request Source: https://easydigitaldownloads.com/docs/software-licensing-api.md Example URL for performing a remote license activation request. ```text https://YOURSITE.com/?edd_action=activate_license&item_id=8&license=cc22c1ec86304b36883440e2e84cddff&url=https://licensedsite.com ``` -------------------------------- ### Combined parameter example Source: https://easydigitaldownloads.com/docs/downloads-shortcode.md Demonstrates using multiple parameters simultaneously to filter and format the output. ```text [[downloads category="14,15" number="10" columns="2"]] ``` -------------------------------- ### Sample Products JSON Response Source: https://easydigitaldownloads.com/docs/edd-rest-api-products.md An example of the JSON structure returned when querying the products endpoint. ```json { "products": [ { "info": { "id": 435, "slug": "test-2", "title": "Test", "create_date": "2013-02-06 19:25:18", "modified_date": "2013-02-12 09:40:31", "status": "publish", "link": "https://localhost/wordpress/?post_type=download&p=435", "permalink": "https://localhost/wordpress/?p=435", "content": "Test", "thumbnail": "https://localhost/wordpress/wp-content/uploads/edd/2013/01/2649089468_abb2633bc6_o.jpg" }, "stats": { "total": { "sales": "6", "earnings": "60" }, "monthly_average": { "sales": 6, "earnings": 60 } }, "pricing": { "amount": "29000.00" }, "files": [ { "name": "", "file": "test", "condition": "all" } ], "notes": "" }, { "info": { "id": 16, "slug": "simple-notices-pro", "title": "Simple Notices Pro", "create_date": "2013-01-07 22:42:18", "modified_date": "2013-02-25 16:16:39", "status": "publish", "link": "https://localhost/wordpress/?post_type=download&p=16", "content": "Dapibus dignissim hac ac penatibus eros, quis diam augue! Nisi dapibus in ridiculus auctor ridiculus scelerisque turpis augue, vel turpis ac odio egestas urna, eros in augue amet, mus et? Nisi est tincidunt ultricies et montes, massa sit. Nec purus? Est cras arcu vut pid? In, dapibus urna porttitor pellentesque pellentesque scelerisque! Diam vel in, adipiscing, dictumst? Cursus vut nec? Cras amet nunc? Tortor vel. Tempor phasellus integer et, turpis nec in! Ut vel turpis, ac dictumst augue! Auctor vel ut, penatibus parturient aliquam, porttitor! Aliquet vut magna eu, ac, aliquam montes a vel, odio, dictumst nec enim vel, pulvinar. Mattis dignissim, urna lacus purus integer, eros vel! Augue dictumst, in arcu integer magna elementum ut. Pid a lacus ultrices.", "thumbnail": "https://localhost/wordpress/wp-content/uploads/2013/01/edd_product_support.png" }, "stats": { "total": { "sales": "47", "earnings": "902.2" }, "monthly_average": { "sales": 47, "earnings": 902.2 } }, "pricing": { "priceone": "20", "pricetwo": "30", "price3": "40.55" }, "files": [ { "name": "Screenshot from 2013-01-09 16:21:43", "file": "https://localhost/wordpress/wp-content/uploads/edd/2013/01/Screenshot-from-2013-01-09-162143.png", "condition": "all" }, { "name": "Screenshot from 2013-01-14 09:37:41", "file": "https://localhost/wordpress/wp-content/uploads/edd/2013/02/Screenshot-from-2013-01-14-093741.png", "condition": "1" } ], "notes": "These are the product notes." } ] } ``` -------------------------------- ### Create and Update Payments Source: https://easydigitaldownloads.com/docs/edd_payment.md Examples for initializing a new payment or modifying an existing one. ```php $payment = new EDD_Payment(); $payment->add_download( 97 ); $payment->email = 'steve@example.com'; $payment->status = 'complete'; $payment->save(); ``` ```php $payment = new EDD_Payment( 4023 ); $payment->email = 'steve@example.com'; $payment->save(); ``` -------------------------------- ### Example populated EDD_Subscription object Source: https://easydigitaldownloads.com/docs/recurring-payments-developer-edd_subscription.md The structure returned when instantiating an existing subscription. ```text EDD_Subscription Object ( [subs_db:EDD_Subscription:private] => EDD_Subscriptions_DB Object ( [table_name] => wp_edd_subscriptions [version] => 1.0 [primary_key] => id ) [id] => 1 [customer_id] => 3 [period] => month [initial_amount] => 50.00 [recurring_amount] => 50.00 [bill_times] => 0 [parent_payment_id] => 87 [product_id] => 85 [created] => 2016-03-15 15:36:30 [expiration] => 2016-04-15 23:59:59 [status] => pending [profile_id] => paypal-363e3cc178dab152bb59b958024bce75 [gateway] => paypal [customer] => EDD_Customer Object ( [id] => 3 [purchase_count] => 3 [purchase_value] => 110.000000 [email] => user@example.com [name] => Bob Smith [date_created] => 2016-03-08 15:01:02 [payment_ids] => 54,63,87,88,91 [user_id] => 2 [notes] => Array ( [0] => March 16, 2016 14:37:22 - Subscription #3 cancelled admin ) [db:protected] => EDD_DB_Customers Object ( [table_name] => wp_edd_customers [version] => 1.0 [primary_key] => id ) ) ) ``` -------------------------------- ### Template Part Reference Source: https://easydigitaldownloads.com/docs/template-files-for-download-product-pages.md Example of how get_template_part maps to specific theme files. ```php get_template_part( 'content', 'single' ) ``` -------------------------------- ### Example UTM URL Structure Source: https://easydigitaldownloads.com/docs/tracking-marketing-campaigns.md A sample URL demonstrating the inclusion of UTM parameters for tracking traffic sources. ```text https://yourstore.com/downloads/my-product/?utm_source=facebook&utm_medium=social&utm_campaign=summer_sale ``` -------------------------------- ### Reviews query response structure Source: https://easydigitaldownloads.com/docs/reviews-rest-api.md Example JSON response containing a list of reviews and metadata. ```json { "reviews": { "total": "2", "most_recent": [ { "id": "63", "title": null, "parent": "60", "download_id": "1568", "download_title": "Endless Possibilities", "rating": null, "author": "Sunny Ratilal", "email": "dev@local.dev", "IP": "172.17.0.1", "date": "2016-07-20 17:24:48", "date_gmt": "2016-07-20 17:24:48", "content": "Replying to test review", "status": "1", "user_id": "1", "type": "reply", "votes": null }, { "id": "61", "title": "Great read", "parent": "0", "download_id": "1566", "download_title": "eBook", "rating": "4", "author": "Sunny Ratilal", "email": "dev@local.dev", "IP": "172.17.0.1", "date": "2016-07-19 19:25:22", "date_gmt": "2016-07-19 19:25:22", "content": "Well written book", "status": "1", "user_id": "1", "type": "review", "votes": { "yes": "3", "no": "0" } }, ] }, "request_speed": 0.08372688293457 } ``` -------------------------------- ### Beta Version API Request Source: https://easydigitaldownloads.com/docs/software-licensing-api.md Example URL for requesting information about a beta version by appending the beta parameter. ```text https://YOURSITE.com/?edd_action=get_version&item_id=8&license=cc22c1ec86304b36883440e2e84cddff&url=https://licensedsite.com&beta=1 ``` -------------------------------- ### Verify cURL installation Source: https://easydigitaldownloads.com/docs/software-licensing-api-example-using-curl.md Check if cURL is available on the system by running the command without arguments. ```bash curl ``` -------------------------------- ### License Response Structure Source: https://easydigitaldownloads.com/docs/software-licensing-api.md Example of the JSON object returned when checking a license status. ```json { "license": "invalid", "item_id": false (or Item ID if passed) "item_name": "EDD Product Name", "error": "expired", "expires": "2020-04-28 23:59:59", "license_limit": 0, "site_count": 1, "activations_left": "unlimited", "checksum": "", "payment_id": 12345, "customer_name": "John Doe", "customer_email": "john@sample.com", "price_id": "2" } ``` -------------------------------- ### Implementing a callback for edd_complete_purchase Source: https://easydigitaldownloads.com/docs/edd_complete_purchase.md Use this example to retrieve payment meta and cart details when a purchase is completed. ```php function pw_edd_on_complete_purchase( $payment_id ) { // Basic payment meta $payment_meta = edd_get_payment_meta( $payment_id ); // Cart details $cart_items = edd_get_payment_meta_cart_details( $payment_id ); // do something with payment data here } add_action( 'edd_complete_purchase', 'pw_edd_on_complete_purchase' ); ``` -------------------------------- ### Retrieve Product-specific Sales Source: https://easydigitaldownloads.com/docs/edd_payment_stats.md Example of fetching sales for a specific download ID over a date range. ```php // Sales for download ID 44 from July 2 to August 5, 2013 echo $stats->get_sales( 44, 'July 2, 2013', 'August 5, 2013' ); ``` -------------------------------- ### Sales Stats for Individual Product Query and Response Source: https://easydigitaldownloads.com/docs/edd-rest-api-stats.md Example of querying sales stats for a specific product ID. ```text https://yoursite.com/edd-api/stats/?key=c281cf0a95be875d9eeb284fb004c938&token=5f9432f3ffa5945755ebc66179810d70&type=sales&product=16 ``` ```json { "sales": [ { "simple-notices-pro": "48" } ] } ``` -------------------------------- ### Retrieve Best Selling Products Source: https://easydigitaldownloads.com/docs/edd_payment_stats.md Example of fetching the top selling products as an array of objects. ```php $best_selling = $stats->get_best_selling( '10' ); ``` -------------------------------- ### Example Permalink Structure with index.php Source: https://easydigitaldownloads.com/docs/ios-app.md This structure is known to cause 404 errors when connecting to the iOS app. ```text /index.php/%year%/%monthnum%/%day%/%postname%/ ``` -------------------------------- ### Sales Stats by Date Query and Response Source: https://easydigitaldownloads.com/docs/edd-rest-api-stats.md Example of querying sales stats for a specific date. ```text https://yoursite.com/edd-api/stats/?key=c281cf0a95be875d9eeb284fb004c938&token=5f9432f3ffa5945755ebc66179810d70&type=sales&date=today ``` ```json { "sales": { "today": 1 } } ``` -------------------------------- ### Display and Store Download Prices Source: https://easydigitaldownloads.com/docs/edd_price.md Examples showing how to output prices directly, store them in a variable, and access specific price variations. ```php edd_price( 12 ); // will output something like $10 for product 12 ``` ```php $edd_price = edd_price( 12, false ); // stores the amount for download id 12 in $edd_price ``` ```php edd_price( 12, true, 1 ); // echos the price of the first variation on download id 12 ``` -------------------------------- ### Retrieve Product-specific Earnings Source: https://easydigitaldownloads.com/docs/edd_payment_stats.md Example of fetching earnings for a specific download ID on a specific date. ```php // Earnings for download ID 52 for December 5, 2012 echo $stats->get_earnings( 52, '12-05-2012' ) ``` -------------------------------- ### Get Recurring Customer IDs Source: https://easydigitaldownloads.com/docs/recurring-payments-developer-edd_recurring_subscriber.md Example of the array structure returned by get_recurring_customer_ids and the associated filter hook. ```php Array ( [stripe] => cus_85YmUU1QuH5yxY ) ``` ```php apply_filters( 'edd_recurring_customer_ids', $ids, $this ); ``` -------------------------------- ### Sales Stats Query and Response Source: https://easydigitaldownloads.com/docs/edd-rest-api-stats.md Example of a basic sales query and its corresponding JSON response. ```text https://yoursite.com/edd-api/stats/?key=c281cf0a95be875d9eeb284fb004c938&token=5f9432f3ffa5945755ebc66179810d70&type=sales ``` ```json { "sales": { "current_month": 1, "last_month": 18, "totals": 71 } } ``` -------------------------------- ### Display downloads with default configuration Source: https://easydigitaldownloads.com/docs/downloads-shortcode.md Use the basic shortcode to output downloads in a three-column grid with default settings. ```text [[downloads]] ``` -------------------------------- ### Initialize Theme License Handler Source: https://easydigitaldownloads.com/docs/software-licensing---updater-implementation-for-wordpress-themes Registers the theme with the Software Licensing SDK and loads the required SDK files from the vendor directory. ```php /** * This is just a demonstration of how theme licensing works with * Easy Digital Downloads. * * @package EDD Sample Theme */ /** * Load theme updater functions. * Action is used so that child themes can easily disable. */ /** * Initialize the theme license handler and updater. * * This registry handles activating and deactivating the license key, * as well as checking for updates to the theme. */ add_action( 'edd_sl_sdk_registry', function ( $init ) { $init->register( array( 'id' => 'edd-sample-theme', 'url' => 'https://edd.local', 'item_id' => 36894, 'version' => '1.0.0', 'file' => __FILE__, 'type' => 'theme', ) ); } ); // Load the SDK from the vendor directory. The SDK handles autoloader setup automatically. if ( file_exists( __DIR__ . '/vendor/easy-digital-downloads/edd-sl-sdk/edd-sl-sdk.php' ) ) { require_once __DIR__ . '/vendor/easy-digital-downloads/edd-sl-sdk/edd-sl-sdk.php'; } } ``` -------------------------------- ### Campaign Data Output Example Source: https://easydigitaldownloads.com/docs/campaign-tracker The rendered output of the {campaign_info} tag when campaign data is present on an order. ```text Campaign Information: Campaign: summer_sale_2027 Source: facebook Medium: social ``` -------------------------------- ### Create customers Source: https://easydigitaldownloads.com/docs/wp-cli-commands.md Commands to create single or bulk customers with optional email, name, and user ID parameters. ```bash wp edd customers --create=1 ``` ```bash wp edd customers --create=1 --email=john@test.com ``` ```bash wp edd customers --create=1 --email=john@test.com --name="John Doe" ``` ```bash wp edd customers --create=1 --email=john@test.com --name="John Doe" user_id=1 ``` ```bash wp edd customers --create=1000 ``` -------------------------------- ### GET /edd-api/customers/ Source: https://easydigitaldownloads.com/docs/edd-rest-api-customers.md Retrieve a list of customers from the shop. ```APIDOC ## GET /edd-api/customers/ ### Description Retrieves a list of customers who have purchased items from the shop. ### Method GET ### Endpoint /edd-api/customers/ ### Parameters #### Query Parameters - **key** (string) - Required - API key for authentication - **token** (string) - Required - API token for authentication - **number** (integer) - Optional - The number of customers to return - **customer** (string) - Optional - The identifier (ID or email) of a specific customer to retrieve ### Response #### Success Response (200) - **customers** (array) - A list of customer objects containing info and stats #### Response Example { "customers": [ { "info": { "id": -1, "username": "Guest", "display_name": "Guest", "first_name": "Guest", "last_name": "Guest", "email": "johnson@test.com" }, "stats": { "total_purchases": 2, "total_spent": "20", "total_downloads": 0 } } ] } ``` -------------------------------- ### Load an Existing Download Source: https://easydigitaldownloads.com/docs/edd_download.md Initialize the class by passing the specific Download ID to the constructor. ```php $my_download = new EDD_Download( 1492 ); ``` -------------------------------- ### Specific Endpoint Request Source: https://easydigitaldownloads.com/docs/edd-rest-api-endpoints.md Example of targeting the sales endpoint. ```text https://example.com/edd-api/sales/ ``` -------------------------------- ### Get total earnings Source: https://easydigitaldownloads.com/docs/edd_download.md Retrieves the total earnings for the download. ```php $download_earnings = $my_download->get_earnings(); ``` -------------------------------- ### Register Plugin with EDD Software Licensing SDK Source: https://easydigitaldownloads.com/docs/software-licensing-updater-implementation-for-wordpress-plugins.md Initializes the SDK registry and loads the SDK from the vendor directory. Ensure the file path to the SDK matches your project structure. ```php /**

* Plugin Name: AAA Sample Plugin

* Plugin URI: https://easydigitaldownloads.com

* Description: Illustrates how to include an updater in your plugin for EDD Software Licensing.

* Author: Sandhills Development, LLC

* Author URI: https://easydigitaldownloads.com

* Version: 1.0.0

* License: GNU General Public License v2.0 or later

* License URI: https://www.gnu.org/licenses/gpl-2.0.html

*/



add_action(

'edd_sl_sdk_registry',

function ( $init ) {

$init->register(

array(

'id' => 'edd-sample-plugin', // The plugin slug.

'url' => 'https://edd.local', // The URL of the site with EDD installed.

'item_id' => 83, // The download ID of the product in Easy Digital Downloads.

'version' => '1.0.0', // The version of the product.

'file' => __FILE__, // The path to the main plugin file.

)

);

}

);



// Load the SDK from the vendor directory. The SDK handles autoloader setup automatically.

if ( file_exists( __DIR__ . '/vendor/easy-digital-downloads/edd-sl-sdk/edd-sl-sdk.php' ) ) {

require_once __DIR__ . '/vendor/easy-digital-downloads/edd-sl-sdk/edd-sl-sdk.php';

} ``` -------------------------------- ### EDD_Recurring_Subscriber Object Structure Source: https://easydigitaldownloads.com/docs/recurring-payments-developer-edd_recurring_subscriber.md Example of the object structure returned after initialization. ```php EDD_Recurring_Subscriber Object ( [subs_db:EDD_Recurring_Subscriber:private] => EDD_Subscriptions_DB Object ( [table_name] => wp_edd_subscriptions [version] => 1.4.1.3 [primary_key] => id ) [id] => 11111 [purchase_count] => 19 [purchase_value] => 2173.3 [email] => user@example.com [emails] => Array ( [0] => user@example.com ) [name] => Bob Smith [date_created] => 2015-06-15 16:38:08 [payment_ids] => [user_id] => 1nan1 [notes:protected] => [raw_notes:EDD_Customer:private] => [db:protected] => EDD_DB_Customers Object ( [meta_type] => customer [date_key] => date_created [cache_group] => customers [table_name] => wp_edd_customers [version] => 1.0 [primary_key] => id ) ) ``` -------------------------------- ### Retrieve Store-wide Earnings Source: https://easydigitaldownloads.com/docs/edd_payment_stats.md Example of fetching earnings for a specific date. ```php // Store-wide earnings for August 2, 2013 echo $stats->get_earnings( 0, 'August 2, 2013' ); ``` -------------------------------- ### Define Preset License Keys Source: https://easydigitaldownloads.com/docs/software-licensing-usage-instructions.md Example format for entering custom license keys in the Preset License Keys textarea, with one key per line. ```text customkey1

customkey2

customkey3

customkey4

customkey5 ``` -------------------------------- ### Create a New Download Source: https://easydigitaldownloads.com/docs/edd_download.md Instantiate the class and call the create method to generate a new download product. Arguments compatible with wp_insert_post can be passed to customize the download properties. ```php $new_download = new EDD_Download; $new_download->create(); ``` ```php $new_download = new EDD_Download; $download_args = array( 'post_title' => 'My eBook', 'post_content' => 'This is my eBook. Nice long description.', 'post_status' => 'publish', ) $new_download->create( $download_args ); ``` -------------------------------- ### GET /edd-api/reviews/ Source: https://easydigitaldownloads.com/docs/reviews-rest-api.md Retrieves a list of reviews placed on all products from the store. ```APIDOC ## GET /edd-api/reviews/ ### Description Retrieves a list of reviews placed on all products from the store. ### Method GET ### Endpoint /edd-api/reviews/ ### Parameters #### Query Parameters - **key** (string) - Required - API key for authentication - **token** (string) - Required - API token for authentication - **review_id** (integer) - Optional - The unique identifier for a specific review ### Response #### Success Response (200) - **reviews** (object) - Contains the review data or list of reviews - **request_speed** (float) - The time taken for the request #### Response Example { "reviews": { "total": "2", "most_recent": [ { "id": "63", "title": null, "parent": "60", "download_id": "1568", "download_title": "Endless Possibilities", "rating": null, "author": "Sunny Ratilal", "email": "dev@local.dev", "IP": "172.17.0.1", "date": "2016-07-20 17:24:48", "date_gmt": "2016-07-20 17:24:48", "content": "Replying to test review", "status": "1", "user_id": "1", "type": "reply", "votes": null } ] }, "request_speed": 0.08372688293457 } ``` -------------------------------- ### Get download notes Source: https://easydigitaldownloads.com/docs/edd_download.md Retrieves the notes associated with a download as a string. ```php $download_notes = $my_download->get_notes(); ``` -------------------------------- ### Display products with the [downloads] shortcode Source: https://easydigitaldownloads.com/docs/faqs.md Use this shortcode to render a product archive with a specific number of items and column layout. ```text [downloads number="15" columns="3"] ``` -------------------------------- ### Get download type Source: https://easydigitaldownloads.com/docs/edd_download.md Returns whether the download is a bundle or default. ```php $download_type = $my_download->get_type(); ``` -------------------------------- ### GET /edd-api/v2/products/ Source: https://easydigitaldownloads.com/docs/edd-rest-api-v2-products.md Retrieves a list of products filtered by category or tag. ```APIDOC ## GET /edd-api/v2/products/ ### Description Retrieves a list of products from the store. Results can be filtered by category or tag using query parameters. ### Method GET ### Endpoint https://example.com/edd-api/v2/products/ ### Query Parameters - **category** (string/integer) - Optional - Filter products by category slug or ID. - **tag** (string/integer) - Optional - Filter products by tag slug or ID. ### Request Example https://example.com/edd-api/v2/products/?category=ebooks&tag=pdf ``` -------------------------------- ### API Response Structure Source: https://easydigitaldownloads.com/docs/software-licensing-api.md Example of the JSON object returned by the get_version action. ```json { "new_version": "2.0", "stable_version": "2.0", "name": "Restrict Content Pro", "slug": "restrict-content-pro", "url": "https://edd.com/downloads/restrict-content-pro/?changelog=1", "last_updated": "2017-01-03 11:59:46", "homepage": "https://edd.com/downloads/restrict-content-pro/", "package": "", "download_link": "", "sections": "a:2:{s:11:\"description\";s:793:\"

Placerat porta in enim, urna cras, adipiscing augue dis lorem, pulvinar, natoque phasellus eu tincidunt, dictumst nunc ut dignissim turpis ac, pulvinar! Massa! Sed, enim, eu ac augue placerat scelerisque! Eu cursus, ridiculus cum nec lorem, natoque lorem dictumst amet! Nunc placerat dapibus enim dignissim, nunc mattis vel? Dolor nascetur placerat ridiculus augue massa porttitor turpis auctor, etiam et nisi pid ridiculus nisi duis ac. Turpis et non, dapibus diam! Placerat vel? Et, velit turpis mus sociis arcu, vel magna. Habitasse elementum elit cum nec est, eu, montes egestas est mattis lacus, turpis urna parturient, egestas, integer augue, penatibus natoque elit, rhoncus mid elementum, integer vut turpis. Et? Nisi pid. Nec, placerat ut tristique lorem a nunc velit nunc est.

n\";s:9:\"changelog\";s:0:\"\";}", "banners": "a:2:{s:4:\"high\";s:0:\"\";s:3:\"low\";s:0:\"\";}" } ``` -------------------------------- ### Customize Purchase and Login Instructions Source: https://easydigitaldownloads.com/docs/all-access-creating-all-access-products.md Add custom text instructions above the purchase and login buttons for users who do not have an active All Access Pass. ```shortcode [[downloads all_access_customer_downloads_only="yes" buy_instructions="Purchase this to get All Access and unlock this page." login_instructions="If you have already purchased, simply log in!"]] ``` -------------------------------- ### Run full order migration via CLI Source: https://easydigitaldownloads.com/docs/troubleshooting-30-migration.md Executes the default migration process for all payment objects. ```bash wp edd migrate_payments ``` -------------------------------- ### Review Data Structure Source: https://easydigitaldownloads.com/docs/reviews-rest-api.md Example of the JSON response structure for a review object. ```json "author": "Sunny Ratilal", "email": "dev@local.dev", "IP": "172.17.0.1", "date": "2016-07-19 19:25:22", "date_gmt": "2016-07-19 19:25:22", "content": "Well written book", "status": "1", "user_id": "1" }, "request_speed": 0.0022079944610596 } ``` -------------------------------- ### Example EDD_Subscription object structure Source: https://easydigitaldownloads.com/docs/recurring-payments-developer-edd_subscription.md The structure returned by an empty EDD_Subscription object. ```text EDD_Subscription Object ( [subs_db:EDD_Subscription:private] => EDD_Subscriptions_DB Object ( [table_name] => wp_edd_subscriptions [version] => 1.0 [primary_key] => id ) [id] => 0 [customer_id] => 0 [period] => [initial_amount] => [recurring_amount] => [bill_times] => 0 [parent_payment_id] => 0 [product_id] => 0 [created] => 0000-00-00 00:00:00 [expiration] => 0000-00-00 00:00:00 [status] => pending [profile_id] => [gateway] => [customer] => ) ``` -------------------------------- ### Hooking into admin_init for License Activation Source: https://easydigitaldownloads.com/docs/software-licensing-activating-checking-and-deactivating-license-keys-in-wordpress-plugins.md Use this function hooked to admin_init to detect when the 'Activate License' button is clicked and trigger the remote API request. ```php function edd_sample_activate_license() { // listen for our activate button to be clicked if( isset( $_POST['edd_license_activate'] ) ) { // run a quick security check if( ! check_admin_referer( 'edd_sample_nonce', 'edd_sample_nonce' ) ) return; // get out if we didn't click the Activate button // retrieve the license from the database $license = trim( get_option( 'edd_sample_license_key' ) ); // data to send in our API request $api_params = array( 'edd_action'=> 'activate_license', 'license' => $license, 'item_name' => urlencode( 'My Plugin Name' ), // the name of our product in EDD 'url' => home_url() ); // call the custom API. $response = wp_remote_post( 'https://easydigitaldownloads.com', array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) ); // make sure the response came back okay if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) { if ( is_wp_error( $response ) ) { $message = $response->get_error_message(); } else { $message = __( 'An error occurred, please try again.' ); } } else { $license_data = json_decode( wp_remote_retrieve_body( $response ) ); if ( false !== $license_data->success ) { if( 'valid' == $license_data->license ) { update_option( 'edd_sample_license_status', 'valid' ); } } } } } add_action( 'admin_init', 'edd_sample_activate_license' ); ``` -------------------------------- ### Retrieve Store-wide Sales Source: https://easydigitaldownloads.com/docs/edd_payment_stats.md Example of fetching total sales for the current month. ```php // Store-wide sales for this month: echo $stats->get_sales( 0, 'this_month' ); ``` -------------------------------- ### Create a custom free download link with shortcode Source: https://easydigitaldownloads.com/docs/free-downloads-advanced-usage.md Use the edd_free_download shortcode to wrap custom content like images into a download trigger. ```shortcode [edd_free_download download_id="123"]YOUR IMAGE HERE[/edd_free_download] ``` -------------------------------- ### Add content before product content Source: https://easydigitaldownloads.com/docs/adding-html-before-or-after-download-product-content.md Uses the edd_before_download_content hook to output custom HTML before the main product content. ```php function pw_edd_before_download_content( $download_id ) { echo 'This is content added before the main product content.'; } add_action( 'edd_before_download_content', 'pw_edd_before_download_content' ); ``` -------------------------------- ### Get sales count Source: https://easydigitaldownloads.com/docs/edd_download.md Retrieves the total number of completed sales for the download. ```php $download_sales = $my_download->get_sales(); ``` -------------------------------- ### Get file price condition Source: https://easydigitaldownloads.com/docs/edd_download.md Retrieves the price condition associated with the file. ```php $price_condition = $my_download->get_file_price_condition(); ``` -------------------------------- ### Configure Download Arguments Source: https://easydigitaldownloads.com/docs/edd_payment.md Default argument structures for adding or removing downloads from a payment. ```php 'quantity' => 1, 'price_id' => false, 'item_price' => 0.00, 'tax' => 0.00, 'fees' => array() ``` ```php 'quantity' => 1, 'price_id' => false, 'item_price' => 0.00, 'cart_index' => false, ``` -------------------------------- ### Get download limit Source: https://easydigitaldownloads.com/docs/edd_download.md Retrieves the maximum number of times a file can be downloaded. ```php $download_limit = $my_download->get_file_download_limit(); ``` -------------------------------- ### Instantiate License Objects Source: https://easydigitaldownloads.com/docs/software-licensing-developer-customizations.md Use the wrapper method to instantiate license objects with caching, or instantiate the class directly. ```php // Instantiate a license via ID $license = edd_software_licensing()->get_license( 2326422 ); // Instantiate a license via the license key $license_by_key = edd_software_licensing->get_license( '9e21e9a885212f96cccb4d6186541332', true ); // If you pass in an invalid license ID or key you will get 'false' as a response. $invalid_license = edd_software_licensing()->get_license( -1 ); ``` ```php $license = new EDD_SL_License( 2326422 ); ``` ```php $license = new EDD_SL_License(); $license->create( $download_id = 0, $payment_id = 0, $price_id = false, $cart_index = 0, $options = array() ); ``` -------------------------------- ### GET /edd-api/v2/products/ Source: https://easydigitaldownloads.com/docs/edd-rest-api-v2-products.md Retrieves a list of products from the Easy Digital Downloads store. ```APIDOC ## GET /edd-api/v2/products/ ### Description Retrieves a list of products available in the store. This endpoint does not require an API key or token for publicly available products. ### Method GET ### Endpoint /edd-api/v2/products/ ### Response #### Success Response (200) - **products** (array) - A list of product objects containing info, stats, pricing, files, and licensing details. #### Response Example { "products": [ { "info": { "id": 45, "slug": "pdf-test", "title": "PDF Test", "create_date": "2016-05-23 18:44:51", "modified_date": "2016-06-08 17:30:54", "status": "publish", "link": "https://example.com/?post_type=download&p=45", "content": "", "excerpt": "", "thumbnail": false, "category": [], "tags": [], "sku": "AAMAM2016" }, "stats": { "total": { "sales": "0", "earnings": "0.00" }, "monthly_average": { "sales": "0", "earnings": "0.00" } }, "pricing": { "amount": "1.00" }, "files": [], "notes": "", "licensing": { "enabled": false, "version": "", "exp_unit": "days", "exp_length": "" } } ] } ``` -------------------------------- ### Create a New Customer Source: https://easydigitaldownloads.com/docs/edd_customer.md Create a customer record by instantiating the class and calling the create method with an array of arguments. ```php $customer = new EDD_Customer; $args = array( 'user_id' => 12 'name' => 'Jose Canseco', 'email' => 'jose@canseco.com', 'payment_ids' => '', 'purchase_value' => '', 'purchase_count' => '', 'notes' => 'Whatever note you'd like', ); $customer->create( $args ); ``` ```php $args = array( 'email' => 'jose@canseco.com', ); $customer->create( $args ); ``` -------------------------------- ### GET/POST /?edd_action=activate_license Source: https://easydigitaldownloads.com/docs/software-licensing-api.md Activates a license key for a specific product. ```APIDOC ## GET/POST /?edd_action=activate_license ### Description Used to remotely activate a license key for a product. ### Method GET or POST ### Endpoint /?edd_action=activate_license ### Parameters #### Query Parameters - **edd_action** (string) - Required - Must be "activate_license" - **item_id** (integer) - Required - The Download ID of the product - **item_name** (string) - Optional - The name of the download (alternative to item_id) - **license** (string) - Required - The license key to activate - **url** (string) - Optional - The site URL or unique identifier for the licensed site ### Response #### Success Response (200) - **success** (boolean) - Indicates if the activation was successful - **license** (string) - Status of the license - **item_id** (integer/boolean) - The ID of the item - **item_name** (string) - Name of the product - **license_limit** (integer) - Maximum allowed activations - **site_count** (integer) - Number of current activations - **expires** (string) - Expiration date of the license - **activations_left** (string) - Remaining activations - **checksum** (string) - MD5 checksum - **payment_id** (integer) - Associated payment ID - **customer_name** (string) - Name of the customer - **customer_email** (string) - Email of the customer - **price_id** (string) - Price ID associated with the license ``` -------------------------------- ### Single review response structure Source: https://easydigitaldownloads.com/docs/reviews-rest-api.md Example JSON response for a single review lookup. ```json { "reviews": { "id": "61", "title": "Great read", "parent": "0", "download_id": "1566", "download_title": "eBook", "rating": "4", ``` -------------------------------- ### Restrict content with preview and instructions Source: https://easydigitaldownloads.com/docs/all-access-shortcodes.md Displays a preview image and custom instructions for users who do not have access to the wrapped content. ```shortcode [edd_aa_all_access id="YOUR_ALL_ACCESS_PRODUCT_ID_HERE" preview_image="https://url-to-image.jpg" buy_instructions="Buy Now to unlock access" login_instructions="Already purchased? Login here to unlock access"] Your restricted content goes here. It can be HTML. [/edd_aa_all_access] ``` -------------------------------- ### Example output of price range Source: https://easydigitaldownloads.com/docs/showing-the-price-for-a-download.md The expected output format when using the edd_price_range function. ```text $15 - $35 ```