HDWebmobile Sales Countdown
Sale countdown timers and low-stock urgency labels — the “only N left” figure is read live from real stock, and every label is admin-only and escaped.
Overview
HDWebmobile Sales Countdown adds three small pieces of urgency to your store: a per-product sale countdown on products whose sale has a scheduled end date (“Sale ends in 02:14:09,” ticking down), a store-wide countdown bar with your own end time and text that hides itself when time passes, and a low-stock label (“Only 3 left in stock”) on products with managed stock at or below a threshold you choose.
Countdown and scarcity plugins are a recurring home for two problems, and this plugin is built so neither can happen. No stored XSS from a timer label: every label and piece of text is set only on the plugin’s settings page, saved through WordPress’s own Settings API (which enforces the manage_options capability and a nonce), sanitised with sanitize_text_field(), and printed with esc_html()/esc_attr(). There is no rich-text field, and nothing a shopper submits is ever displayed. The countdown script itself only reads a numeric timestamp from a data- attribute and only writes element.textContent — it never assigns innerHTML and never inserts markup. No fake scarcity either: the “only N left” number is always WC_Product::get_stock_quantity() — WooCommerce’s real, current stock, never a number an admin types in or a value carried in a request. If a product isn’t managing stock, allows backorders, or is a variable parent, no count is shown at all.
Key Features
- Per-product sale countdown, driven by WooCommerce’s own “Sale price dates”
- Optional store-wide countdown bar with your own end time and text
- Live low-stock label with a configurable threshold and label template ({n} = real stock)
- Works on the classic product template and block-based product templates
- No custom database table, no AJAX, no front-end input
Limitations
Please read before installing:
- Per-product countdown only works on products with a scheduled sale end date
- One store-wide countdown bar at a time — no scheduling multiple upcoming bars
- Low-stock label requires WooCommerce stock management to be enabled on the product
Quick Setup
- Upload the plugin files to the /wp-content/plugins/hdwebmobile-sales-countdown directory, or install through the Plugins screen directly.
- Activate the plugin through the ‘Plugins’ screen in WordPress. WooCommerce must already be installed and active.
- Go to WooCommerce > Sales Countdown to set your low-stock threshold and, optionally, a store-wide bar.
Latest Version
Current stable version in readme: 1.0.0 (Initial release: per-product sale countdown, store-wide countdown bar, real-stock low-stock labels, zero front-end input.)
See our other WordPress plugins for more WooCommerce and site-utility tools.
