=== Checkout Profiler for WooCommerce === Contributors: conschneider Tags: checkout, performance, profiler, speed, debug Requires at least: 6.5 Tested up to: 7.0 Requires PHP: 7.4 Stable tag: 1.1.0 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html Wondering whether your WooCommerce checkout is slow? This plugin will tell you. == Description == Checkout Profiler measures how long placing an order takes in your shop and writes every measurement to the WooCommerce log. No dashboards, no external service — just numbers you can act on, next to the logs you already have. View the results under WooCommerce > Status > Logs, source `checkout-profiler`. Each entry names the order, the duration in seconds and the payment gateway (the gateway usually dominates checkout time): `Classic checkout for order 1234 took 1.311 seconds (payment via stripe).` **Both checkouts are supported:** * **Block checkout** (the default since WooCommerce 8.3): detected automatically, measured in the shopper's browser from the moment they hit "Place Order" until the checkout succeeds — the time your customer actually experiences. * **Classic (shortcode) checkout**: measured in PHP between two hooks. The defaults measure the server-side order processing, including the payment gateway round trip. Works out of the box, no configuration needed. **Configurable for the classic checkout:** * Choose start and end hooks from sensible presets — for example end at `woocommerce_thankyou` to include the redirect to the order confirmation page in the measurement. * Or enter any custom hook name for start and end. **What this plugin is not:** a full APM suite like New Relic. It answers one question — "how slow is my checkout, really?" — with near-zero overhead: one session value, one log line per order, and a small script that only loads on the block checkout page. == Installation == 1. Upload the plugin files to the `/wp-content/plugins/checkout-profiler-for-woocommerce` directory, or install the plugin through the WordPress plugins screen directly. 2. Activate the plugin through the 'Plugins' menu in WordPress. 3. Optional: adjust the classic-checkout hooks under WooCommerce > Settings > Profiler. 4. Do a test purchase and go to WooCommerce > Status > Logs (source: `checkout-profiler`) to see the results. == Frequently Asked Questions == = Does this slow down my website? = No measurable impact. The classic checkout timer stores one timestamp in the WooCommerce session and writes one log line per order. The block checkout script (about 1 KB) loads only on the checkout page, and only when the checkout block is actually in use. = Is the block checkout supported? = Yes, since 1.1.0 (requires WooCommerce 9.8 or newer, where the official checkout events are available). It is detected automatically and measured in the browser — the settings page only applies to the classic checkout. = What exactly is measured? = Classic checkout: the time between the configured start and end hooks, by default from checkout form submission until the order is processed (server-side, including the payment gateway). Block checkout: the time from clicking "Place Order" until the checkout succeeds, as experienced in the shopper's browser. = Where do I see the results? = WooCommerce > Status > Logs, pick the file/source `checkout-profiler`. Note: your WooCommerce log threshold must include `info` messages (it does by default). = Will this work with my theme/pagebuilder/custom checkout? = The block and shortcode checkouts are covered out of the box. For custom checkout flows, point the start and end hooks at any two hooks your flow fires — as long as both fire, the measurement works. = Is this like New Relic? = Of course not. But it pursues a similar goal for a very specific spot: APM tools instrument your whole stack; this plugin tells you plainly how long your checkout takes, with results stored in the WooCommerce logs you already use. == Screenshots == 1. Settings: start/end hooks for the classic checkout, with explanations. 2. The measurements in the WooCommerce log — block and classic checkouts, with payment gateway. 3. The log list under WooCommerce > Status > Logs. == Changelog == = 1.1.0 = * New: block checkout support — measured in the shopper's browser via the WooCommerce checkout events API and logged with order number and payment gateway. (The 1.0.0 block timer never loaded; this is a rebuild.) * New: the log line now includes the payment gateway, since the gateway usually dominates checkout time. * New: durations are rounded to milliseconds for readable logs. * Fix: the plugin now measures out of the box — previously nothing was logged until the settings were saved once. * Fix: the advertised default end hook (`woocommerce_checkout_order_processed`) is now actually the default. * Fix: the Settings link on the Plugins screen points to the Profiler settings tab instead of the admin dashboard. * Fix: empty placeholder scripts and styles are no longer loaded on every front-end page; admin assets load only on the Profiler settings tab. * Fix: block/classic explanation on the settings screen was never displayed due to an invalid field type. * Fix: a custom hook selection with an empty hook name falls back to the default instead of silently breaking the timer. * Compatibility declared with High-Performance Order Storage (HPOS) and the cart/checkout blocks. * Uninstalling the plugin now removes its settings. * Text domain changed to `checkout-profiler-for-woocommerce` so translations can be delivered via wordpress.org language packs. * Requires WordPress 6.5+, PHP 7.4+ and WooCommerce 9.8+ (declared via Requires Plugins / WC headers). = 1.0.0 = * Initial release. == Upgrade Notice == = 1.1.0 = Block checkout support, out-of-the-box defaults, payment gateway in the log line, HPOS compatibility and many fixes. Settings are kept.