=== RIACO Autocomplete Orders for WooCommerce === Contributors: prototipo88 Tags: autocomplete orders, orders, autocomplete, downloadable, woocommerce Requires at least: 5.6 Tested up to: 7.0 Requires PHP: 7.4 Stable tag: 1.0.2 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html Automatically complete WooCommerce orders based on product types and order statuses. Save time and streamline your order fulfillment process. == Description == **RIACO Autocomplete Orders for WooCommerce** helps store owners streamline order management by automatically completing WooCommerce orders based on specific product types and order statuses. If you sell **virtual, downloadable, or digital products**, or if you want to automatically fulfill certain types of orders without manual intervention, this plugin is for you. == Features == **Automatic Order Completion** * Automatically completes orders when all products match the allowed types (virtual, downloadable, simple, variable, grouped, or external products). * Triggered by specific WooCommerce order statuses (e.g., "processing" or "on-hold"). **Logging & Debugging** * Adds internal **logs for completed orders**, including: - Which rules triggered the completion - Timestamp and trigger status * Easily review why an order was autocompleted. **Admin Controls** * Enable or disable the autocomplete functionality via plugin settings. * Fully **translatable** and compatible with multilingual stores. * **Remove all plugin data** (settings & logs) upon uninstall for a clean database. **Developer Friendly** * Uses **`apply_filters()`** and **`do_action()`** hooks to extend behavior. * Includes a **completion action hook**: ` do_action( 'riaco_ao_order_autocompleted', $order, $status_triggered, $matched_rules ); ` * Filter the log messages, completion note, and rule behavior to integrate with other plugins or custom workflows. == How It Works == 1. Select which **order statuses** should trigger the autocomplete check. 2. Choose which **product types** are eligible for automatic completion. 3. When an order reaches a trigger status: - The plugin checks all products in the order. - If they **all match** the allowed types, then the order is **automatically marked as "Completed"**. - A **log entry** is stored with the rules that triggered the completion. == Use Cases == * **Digital Products**: If you sell eBooks, downloadable files, or online courses, your customers can receive their orders instantly without manual approval. * **Instant Fulfillment for Specific Products**: Mark orders as completed right after payment if all products are simple or virtual, reducing admin overhead. * **Dropshipping or External Fulfillment**: If fulfillment happens outside WooCommerce, you can auto-complete to signal the order is processed. * **Reduce Support Tickets**: Customers instantly see their order as completed, reducing "Where is my order?" requests. * **Event Registrations or Subscriptions**: Automatically complete free or pre-paid event registrations without manual intervention. == Settings Overview == After activation, visit: **WooCommerce > Settings > Autocomplete Orders** Available options: * **Enable Autocomplete** Toggle the plugin functionality on/off. * **Trigger Statuses** Select one or more order statuses to run the autocomplete check. * **Product Type Filters** Restrict autocomplete to orders containing only the selected product types. * **Logs Section** Review completed order logs and which rules were triggered. == Logging & Data Handling == * **Logs** are stored in a custom post type for tracking which rules triggered completion. * **Matched rules** are stored as post meta on the order. * **Uninstall Behavior**: When the plugin is deleted from WordPress: - All settings are removed. - All logs are deleted. - Your database is left clean. == Developer Hooks == Developers can customize and extend the plugin via filters and actions: **Actions** * `riaco_ao_order_autocompleted` Fires when an order is automatically completed. `do_action( 'riaco_ao_order_autocompleted', $order, $status_triggered, $matched_rules )` **Filters** * `riaco_should_autocomplete_order` Filter to allow extending the autocomplete logic. `apply_filters( 'riaco_should_autocomplete_order', $should_autocomplete, $order, $status_to, $matched_rules )` * `riaco_ao_completion_note` Allow customization of the internal admin note. `apply_filters( 'riaco_ao_completion_note', esc_html__( 'Order autocompleted by RIACO Autocomplete Orders plugin.', 'riaco-autocomplete-orders' ))` * `riaco_autocomplete_orders_rules` Filter the rules used to determine if an order should autocomplete. `apply_filters( 'riaco_autocomplete_orders_rules', $rules, $order )` * `riaco_autocomplete_trigger_statuses` Filter the list of allowed trigger statuses. `apply_filters( 'riaco_autocomplete_trigger_statuses', $trigger_statuses, $status_to )` * `riaco_ao_log_postarr` Filter the post array before inserting the log entry. `apply_filters( 'riaco_ao_log_postarr', $postarr, $order, $details, $status_triggered, $note )` * `riaco_autocomplete_orders_settings` Filter the settings array for the Autocomplete Orders plugin. `apply_filters( 'riaco_autocomplete_orders_settings', $settings )` * `riaco_autocomplete_order_statuses` Filter the list of order statuses available for autocomplete triggers. `apply_filters( 'riaco_autocomplete_order_statuses', wc_get_order_statuses() )` * `riaco_autocomplete_orders_product_type_options` Filter the product type options for RIACO autocomplete settings. `apply_filters( 'riaco_autocomplete_orders_product_type_options', $options )` == Installation == 1. Upload the plugin files to the `/wp-content/plugins/riaco-autocomplete-orders` directory, or install via the WordPress Plugins screen directly. 2. Activate the plugin through the 'Plugins' menu in WordPress. 3. Go to **WooCommerce > Settings > Autocomplete Orders** to configure options. == Uninstallation == When uninstalled via the WordPress Plugins screen: All settings and logs are deleted. No data is left in the database. == Frequently Asked Questions == = Can I autocomplete only specific product types? = Yes. You can configure which product types should allow automatic completion. The plugin will autocomplete an order **only if all products in the order** match one of the allowed types. = Will this complete physical product orders? = If all products in the order meet the type criteria (e.g. simple product), the order will be marked as completed. = Does this plugin work with all payment gateways? = Yes, the plugin is gateway-agnostic. However, you should only enable autocomplete on statuses that are safe (e.g., after payment is complete). == Screenshots == 1. Settings page inside WooCommerce. 2. Configure trigger statuses and product type filters. == Changelog == = 1.0.2 = * Fix code quality and logic bugs found in audit * Fix text domain to match plugin slug. = 1.0.1 = * Add logging system with matched rules. * Add do_action 'riaco_ao_order_autocompleted'. * Add uninstall cleanup for settings and logs. = 1.0.0 = * Initial release. * Autocomplete based on virtual/downloadable product types. * Settings for trigger statuses. * Basic filter to extend logic. == Roadmap == - Premium version with extended conditions == License == This plugin is licensed under the GPLv2 or later. See [LICENSE](https://www.gnu.org/licenses/gpl-2.0.html) for more details.