=== E.T.T – Easy Time Tracker for WooCommerce === Contributors: dansart Donate link: https://paypal.me/dansart13 Tags: woocommerce, time, tracker, tools, helper Requires at least: 5.6 Tested up to: 7.1 Stable tag: 1.3 License: GPLv3 or later License URI: https://www.gnu.org/licenses/gpl-3.0.html WC requires at least: 7.4.1 WC tested up to: 10.4.3 Requires PHP: 7.4 An easy and efficient way to track time spent on WooCommerce order products. == Description == E.T.T – Easy Time Tracker for WooCommerce helps you keep track of time spent working for clients directly in WooCommerce. Select a client and product, start tracking, and the recorded time will be added to the product quantity. One hour equals one quantity. Decimal values are supported, for example 0.2. The time tracker is displayed in the frontend using the "Easy Time Tracker" block or the shortcode [ett_easy_time_tracker_frontend]. In the block settings, you can select order statuses to hide from the order dropdown. On the Timetracker Settings page (WooCommerce > TimeTracker), you can set after how many minutes without connection a tracker counts as inactive. Phones pause web pages when the screen is locked, so use a higher value (e.g. 30) if you track on a phone. The shortcode accepts the following parameters: - exclude_status, for example exclude_status="reminder-send,invoice-send". This excludes the specified custom order statuses from the order dropdown. The design integrates well with the Gutenberg / Block Editor and other themes. Notifications are shown when tracking starts and every 30 minutes. If you forget to stop the tracker, the tracked minutes can be adjusted manually afterward. The plugin can be customized using hooks and filters. Available hooks: ett_easy_time_tracker_get_ajax_data - Allows modification of the AJAX data array before it is returned. ett_easy_time_tracker_get_ajax_data_field_{name} -Like ett_easy_time_tracker_get_ajax_data, but only for a specific field. ett_easy_time_tracker_get_products_return - Used to alter the returned products array. HTML added to "custom_output" is shown as HTML, so it must be escaped by the code adding it. ett_easy_time_tracker_save_quantity_data - Filter hook allowing changes to the data before it is saved. ett_easy_time_tracker_after_saving_quantity - Action hook triggered after saving quantity data. ett_easy_time_tracker_get_customer_data_attr - Allows altering customer data attributes, for example to add custom titles or additional information to dropdown options. ett_easy_time_tracker_title_parts_filter - Filter hook to modify parts of the order title, for example to add project-related information. ett_easy_time_tracker_exclude_order_status - Filters the accepted statuses. This can be used instead or in addition to the shortcode parameter. ett_easy_time_tracker_before_time_section - Action to add content before the time section ett_easy_time_tracker_after_time_section - Action to add content after the time section ett_easy_time_tracker_log_max_entries - Number of entries kept in the log on the admin page. Default: 200. These hooks provide multiple customization points for AJAX handling, product data, and customer interactions. If you like the plugin, please consider leaving a rating or buying me a coffee. Thank you! = Third party libraries = * Choices.js (https://github.com/Choices-js/Choices), MIT License. Used for the searchable customer and product dropdowns. Bundled in dist/tt-main-script.js. == Installation == 1. Upload the plugin files to the /wp-content/plugins/ett-easy-time-tracker-for-woocommerce directory, or install the plugin through the WordPress plugins screen directly. 2. Activate the plugin through the ‚Plugins‘ screen in WordPress. 3. Enjoy == Screenshots == 1. Frontend page with tracking in progress. == Upgrade Notice == Upload the plugin files to the /wp-content/plugins/ett-easy-time-tracker-for-woocommerce directory, or update the plugin through the WordPress plugins screen directly. == Frequently Asked Questions == Can I use the tracker in the backend? - No, the tool is designed to work in the frontend only. Who can use the tracker? - Everyone who is able to edit WooCommerce orders == Changelog == = [1.3] 2026-11-19 = * Added: "Easy Time Tracker" block for the block editor, with a setting to hide orders by status * Added: Setting "Inactive after X minutes without connection" on the Timetracker Settings page. Shorter interruptions (e.g. a locked phone screen) are always counted. After a longer interruption, the user is asked whether the time without connection should be counted * Added: The tracker reports to the server as soon as the page is visible again (e.g. after unlocking the phone) * Added: Optional "Keep the screen on while tracking" checkbox on phones and tablets (in browsers that support it) * Added: The admin page shows the active trackers and a log below (started, resumed, reconnected, saved, discarded, became inactive, all deleted), including the tracked hours. The latest 200 entries are kept (filter: ett_easy_time_tracker_log_max_entries) * Changed: Stopped and discarded trackers are removed from the active trackers. A tab whose tracker was stopped, discarded or resumed elsewhere ends the tracking and shows the unsaved time * Changed: Active trackers and the log are stored as options instead of a transient, so they no longer expire. Existing trackers are migrated. Both are removed when the plugin is deleted * Changed: The time of the last heartbeat is measured with the server clock, so wrong clocks on devices no longer mark trackers as inactive * Changed: The admin page and its actions now require the `manage_woocommerce` capability * Changed: All AJAX responses are sent as JSON; nonces use a plugin specific action * Changed: One unique prefix for everything: PHP namespace Ett_Easy_Time_Tracker (classes Main, Ajax, Store, Helper; replaces WcTimeTracker*), constants ETT_EASY_TIME_TRACKER_*, script and style handles ett-easy-time-tracker-*, JavaScript object ettEasyTimeTrackerVars (replaces easyTimeTrackerGlobalVars) * Changed: Updated Choices.js from 11.1.0 to 11.2.4 (dropdown options now announce their selected state to screen readers) * Changed: The bundled scripts are loaded as ES modules, reducing conflicts * Fixed: Plugin could not be loaded on PHP 7.4 * Fixed: Fatal error in the shortcode when `is_plugin_active()` was not loaded * Fixed: German JavaScript translations were never loaded; added missing German translations * Fixed: "Delete all trackers" always reported an error; rows in the admin table repeated previous rows; nonce field was printed twice * Fixed: The lock against tracking the same order in two places did not work. * Fixed: Resume / Cancel broke when the description contained an apostrophe * Fixed: Dropdowns stayed disabled when a tracker could not be started * Fixed: Resume crashed when the tracker, order or product no longer existed; resume is blocked while another tracking is running * Fixed: "Stop and fix time" accepted invalid values. Failed saves are now shown and the tracker keeps running * Fixed: The tracking was discarded when the session expired. * Fixed: Line subtotal was not updated when saving the time, which showed up as a discount. Saving now uses the WooCommerce order item API and the price on the order * Fixed: Description date used UTC instead of the site timezone * Fixed: Inactive trackers were only detected while a tracker page was open; the admin page now checks as well * Accessibility: Labels for all fields, announced messages, screen reader texts for the tracker list, correct option roles in the dropdown, better contrast, focus handling after stopping, notification permission is asked on the first start instead of on page load * Accessibility: The admin page uses tables, a settings form and admin notices * Accessibility: Questions in the tracker (count time without connection, discard tracking, stop and fix time) use modal dialogs instead of browser pop-ups = [1.2.3] 2026-06-14 = * Fixed: New tracking could not be started when previous tracking was stopped * Added WooCommerce submenu in backend to show and delete the trackers * Added styles and scripts for the backend * Added admin AJAX handler for backend operations (action: ett_easy_time_tracker_admin_ajax) * Updated build script to include backend style and script entries = [1.2.2] 2026-06-08 = * Fixed `is_order_stopped()`, `is_order_cleared()`, and `is_order_abandoned()` always returning false due to undefined variable in isset() check * Fixed `is_order_abandoned()` returning true for active (non-expired) trackers due to inverted comparison operator * Fixed `save_qty()` checking `is_order_cleared` twice instead of also checking `is_order_stopped` * Fixed undefined variable `$data` passed to `do_action()` in `save_qty()`; now correctly passes `$ajax_data_filtered` * Fixed `get_tracker_by_order_id()` and `clear_trackers()` iterating over a non-array when the transient is empty * Fixed `update_meta()` incorrectly returning true on failure by checking `!== false` instead of `!== 0` * Fixed `wp_kses()` being applied to JSON AJAX responses, which could corrupt the output * Fixed missing `wp_unslash()` on `$_POST['meta_date']` before sanitization * Fixed WooCommerce functions called without global namespace prefix inside namespaced class, causing fatal errors * Added `.distignore` to exclude development files from plugin distribution = [1.2.1] 2026-02-11 = * Refactored code * Removed custom ajax handler in favor of the native handler * Renamed hooks & transients = [1.2] 2026-02-06 = * Improved security with nonce verification * Renamed text-domain * Renamed plugin * Refactored code = [1.0] 2026-01-27 = * Initial Version