Addons

Live View Counter

Adds urgency to product pages by injecting a dynamic "{count} people are watching" line underneath the product summary.

How it works

  • LiveViewCounterAddon hooks into wp_enqueue_scripts and kitbix_commerce_after_product_details.
  • The addon is product-only; assets only load when [kitbix_commerce_product] (or the query var) is present.
  • Counts are generated on the fly using the product ID plus the current minute (generateCount()) so each product gets a unique, believable number.
  • The markup lives in views/live-view-counter.php and inherits storefront typography to blend in.

Settings reference

Field Key Description
Message Template message_template Defaults to {count} people are watching this product right now. The addon auto-appends {count} if you forget to include it.

Frontend behavior

  1. When enabled, the addon enqueues live-view-counter.css and live-view-counter.js on product pages.
  2. Each render passes the calculated count and template into the view.
  3. The JS file simply handles fade-in animations; no polling occurs, so numbers stabilize after load.
  4. The block respects kitbix_commerce_after_product_details priority 20, so it appears below badges but above the Q&A section.

Testing checklist

  • Enable the addon and customize the message template.
  • Open several products; counts should differ per product and per minute.
  • Switch languages to verify {count} is replaced inside translated strings.
  • Disable the addon and confirm the block disappears immediately.

Common pitfalls

  • Expecting literal real-time analytics—this addon intentionally fakes a believable range instead of querying analytics providers.
  • Embedding {count} twice in the template, producing duplicated numbers.
  • Trying to use it on non-product pages; hooks never run outside the product context.
Reminder: The counter runs entirely on the frontend. If caching strips the localized script, purge your cache or add the addon handles to your cache exclusion list.