{"id":18273463,"url":"https://github.com/arraypress/edd-product-query","last_synced_at":"2025-04-09T03:40:37.109Z","repository":{"id":239479546,"uuid":"798945084","full_name":"arraypress/edd-product-query","owner":"arraypress","description":"Extends Easy Digital Downloads (EDD) by providing an advanced product query class that supports complex filtering, sorting, and meta queries.","archived":false,"fork":false,"pushed_at":"2024-05-18T14:56:18.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-14T22:14:01.021Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arraypress.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-10T20:17:37.000Z","updated_at":"2024-05-12T18:56:40.000Z","dependencies_parsed_at":"2024-05-12T19:45:30.543Z","dependency_job_id":"f7eea807-4d25-4668-9d34-4095d5a270c3","html_url":"https://github.com/arraypress/edd-product-query","commit_stats":null,"previous_names":["arraypress/edd-product-query"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arraypress%2Fedd-product-query","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arraypress%2Fedd-product-query/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arraypress%2Fedd-product-query/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arraypress%2Fedd-product-query/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arraypress","download_url":"https://codeload.github.com/arraypress/edd-product-query/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247974584,"owners_count":21026742,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T12:06:33.656Z","updated_at":"2025-04-09T03:40:37.095Z","avatar_url":"https://github.com/arraypress.png","language":"PHP","readme":"# Easy Digital Downloads Product Query Class\n\nEnhance your Easy Digital Downloads add-on or custom theme with advanced querying capabilities. This PHP class allows you to perform intricate product queries using detailed parameters like categories, tags, price ranges, and custom meta data. It leverages WordPress's `WP_Query` to provide optimized, cacheable product listings.\n\n## Features\n\n- **Advanced Taxonomy Filtering**: Use categories and tags in various combinations to refine product searches.\n- **Support for Meta Queries**: Complex queries on custom fields and EDD properties.\n- **Boolean Flags**: Filter products based on boolean values such as whether a product is shippable or has variable pricing.\n- **Transient Caching**: Improve performance by caching query results.\n- **Debugging Mode**: Output the query arguments for analysis and debugging.\n\n## Minimum Requirements ##\n\n* **PHP:** 7.4\n* **WordPress:** 6.5.3\n* **Easy Digital Downloads:** 3.2.12\n\n## Installation ##\n\nThis is not a standalone plugin but a library to be included in your WordPress plugin or theme.\n\nYou can use Composer:\n\n```bash\ncomposer require arraypress/edd-product-query\n```\n\n```php\n// Require the Composer autoloader to enable class autoloading.\nrequire_once __DIR__ . '/vendor/autoload.php';\n\nuse function ArrayPress\\Utils\\EDD\\get_downloads;\n```\n## Usage Examples\n\nThe following examples demonstrate how to use the `get_downloads` function to query EDD products with various criteria:\n\n### Basic Usage\n\nRetrieve products using simple taxonomy and property filters:\n\n```php\n// Use the helper function to get products with specific licensing options.\n$products = get_downloads( [\n    'licensing' =\u003e true // Only products with licensing enabled\n] );\n\n// Retrieve all access products.\n$products = get_downloads( [\n    'all_access' =\u003e true // Only products with all access enabled\n] );\n\n// Retrieve variable priced products.\n$products = get_downloads( [\n    'variable' =\u003e true // Only products with variable pricing enabled\n] );\n\n// Retrieve multi-mode variable priced products.\n$products = get_downloads( [\n    'multi' =\u003e true // Only products with multi-mode enabled\n] );\n\n// Retrieve shippable products.\n$products = get_downloads( [\n    'shipping' =\u003e true // Only products with shipping enabled\n] );\n\n// Retrieve commissions products.\n$products = get_downloads( [\n    'commissions' =\u003e true // Only products with commissions enabled\n] );\n\n// Retrieve commissions products.\n$products = get_downloads( [\n    'commissions' =\u003e true // Only products with commissions enabled\n] );\n\n// Retrieve products with files.\n$products = get_downloads( [\n    'files' =\u003e true // Only products with files\n] );\n\n// Retrieve subscription products.\n$products = get_downloads( [\n    'recurring' =\u003e true // Only products with recurring payments enabled\n] );\n```\n\n\n'files'            =\u003e null,\n'tax_exempt'       =\u003e null,\n'commissions'      =\u003e null,\n'licensing'        =\u003e null,\n'recurring'        =\u003e null,\n'all_access'       =\u003e null,\n'bundles'          =\u003e null,\n'service'          =\u003e null,\n'variable'         =\u003e null,\n'multi'            =\u003e null,\n'shipping'         =\u003e null,\n'type'             =\u003e null,\n\n### Taxonomy Filtering\n\nThe library supports all registered taxonomies and uses specific operators to refine the queries:\n\n```php\n// Query products within a single category.\n$products = get_downloads( [\n    'category' =\u003e 'templates' // Products categorized under 'templates'\n] );\n\n// Query products belonging to multiple categories.\n$products = get_downloads( [\n    'category' =\u003e [ 'templates', 'audio' ] // Products categorized under 'templates' or 'audio'\n] );\n\n// Exclude specific categories.\n$products = get_downloads( [\n    'category__not_in' =\u003e [ 'freebies' ] // Products not in 'freebies' category\n] );\n\n// Products that must match all specified categories.\n$products = get_downloads( [\n    'category__and' =\u003e [ 'templates', 'video' ] // Products must be in both 'templates' and 'video' categories\n] );\n```\n\n### Numeric and Meta Field Queries\n\nYou can directly use numeric fields and comparisons without creating complex meta queries:\n\n```php\n// Query products priced above a certain amount using comparison operators.\n$products = get_downloads( [\n    'price' =\u003e 20,\n    'price_compare' =\u003e '\u003e' // Products priced greater than 20\n] );\n\n// Fetch products with a rating above a specific value.\n$products = get_downloads( [\n    'rating' =\u003e 4,\n    'rating_compare' =\u003e '\u003e=' // Products with a rating of 4 or more\n] );\n```\n**Supported Numeric Comparison Operators:**\n- `=` : Equal to\n- `!=` : Not equal to\n- `\u003e` : Greater than\n- `\u003e=` : Greater than or equal to\n- `\u003c` : Less than\n- `\u003c=` : Less than or equal to\n- `BETWEEN` : Between an array of two values\n- `NOT BETWEEN` : Not between an array of two values\n\n### Debugging\n\nEnable debugging to view the constructed query arguments, aiding in development and troubleshooting:\n\n```php\n// Debugging a query to see the SQL statement.\n$products = get_downloads( [\n    'debug' =\u003e true, // Enable debugging\n    'category' =\u003e 'utilities' // Products in 'utilities' category\n] );\n```\n\n## Contributions\n\nContributions to this library are highly appreciated. Raise issues on GitHub or submit pull requests for bug\nfixes or new features. Share feedback and suggestions for improvements.\n\n## License: GPLv2 or later\n\nThis program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public\nLicense as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later\nversion.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied\nwarranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farraypress%2Fedd-product-query","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farraypress%2Fedd-product-query","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farraypress%2Fedd-product-query/lists"}