=== Stocktake – Physical Inventory Count for WooCommerce ===
Contributors: erenlabs
Tags: stocktake, stock count, physical inventory, inventory count, barcode inventory
Requires at least: 6.2
Tested up to: 7.0
Requires PHP: 7.4
Requires Plugins: woocommerce
Stable tag: 1.1.22
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Stocktake & physical inventory count for WooCommerce: scan to count stock, review variance, blind count, one-click adjust with backup and undo.

== Description ==

Stocktake for WooCommerce is a dedicated stocktake and physical inventory count tool for WooCommerce. Instead of managing stock day to day, it helps you verify what your system says against what is actually on the shelf, then reconcile the difference. Run an unlimited number of stocktake sessions, count with a barcode scanner or by hand, review the variance, and apply corrected stock in one click. It is built for shop owners, warehouse teams, and bookkeepers who need an accurate physical stock count without editing products one at a time.

The core of the plugin is snapshot-based variance. When you start a session, Stocktake records a snapshot of your expected quantities, so you can count while the store stays open and keep trading. As you enter counted quantities, it shows the difference between counted and expected stock, product by product. When you are done, one click adjusts WooCommerce stock to match your count. Every apply is backed up automatically first, so a single undo restores your previous levels if you need it.

Count the way that fits the job: a full or zero-based count for end-of-year and fiscal close, or a partial spot count and cycle count for high-value items you check more often. Scan by barcode, SKU, or product name using USB and Bluetooth scanners, or try phone-camera barcode scanning (Beta) for smaller counts. Turn on blind count to hide expected quantities so counters record reality without bias. Pause and resume an unfinished count at any time, export results to CSV, and see variance value in real money when WooCommerce Cost of Goods data is set.

= Run a physical inventory count / stock count in WooCommerce =

Start a session, scan to count, review the variance, and apply — a complete physical stock count workflow with no CSV round-trips and no editing each product's stock quantity by hand:

1. **Create a session.** Pick a scope (all products or selected categories). A snapshot of current stock is taken so later sales don't distort the variance.
2. **Count.** Open the count screen on a phone or tablet and scan. A recognised barcode is counted on the spot — the cursor never leaves the scan box, so you scan one item after another without stopping. Scan the same product again and it adds on top (5 + 1 = 6, shown clearly). Need a different quantity? Fix it on the editable list of what you just scanned. Optional **blind count** hides the expected number so counters aren't biased.
3. **Review variances.** See expected vs counted, unit differences, and the value of the discrepancy.
4. **Apply.** Post the counted quantities back to WooCommerce stock in one click, with an automatic backup first.
5. **Export.** Download the count sheet as CSV for your records.

= Stocktake free features =

* Unlimited stocktake sessions for physical inventory counts of any size
* Snapshot-based stock variance so you can count while the store stays open
* Full and zero-based counting for end-of-year counts, plus partial and spot cycle counts
* Scan to count by barcode, SKU, or product name with USB and Bluetooth scanners
* Phone-camera barcode scanning (Beta) for smaller counts
* Blind count mode that hides expected quantities to remove counting bias
* One-click stock adjustment to reconcile WooCommerce stock after the count
* Automatic stock backup before every apply, with one-click undo
* Resume an unfinished count at any time
* Reorder and low-stock shortlist with CSV export, plus a negative-stock warning
* CSV export of count results and variance
* Variance value in real money when WooCommerce Cost of Goods data is set

= Stocktake Pro: valuation, shrinkage trend, and team counting =

* Quick stock check — scan any product, see its live stock, and fix a quantity on the spot (audit-logged)
* Add-on-top (tally) and goods-in (receiving) counting modes
* Full restore-point history of your applied counts
* Inventory valuation at retail and cost, with a per-category breakdown
* ABC insights plus an accuracy and shrinkage trend over time
* Per-session variance-by-category reporting
* Multiple counters with attribution (who counted what)
* Recount and approval workflow
* Scheduled stocktake reminders
* Branded PDF count sheets
* Excel (XLSX) export
* Priority support

== Third-party libraries ==

This plugin bundles the ZXing barcode library (@zxing/library, MIT license,
https://github.com/zxing-js/library) at assets/js/vendor/zxing.min.js, used as a
fallback decoder for the phone-camera scanner when the browser has no native
BarcodeDetector. It is served locally and never loaded from a remote CDN.

== External services ==

This plugin uses the Freemius SDK (https://freemius.com) for optional usage
tracking and for licensing/updates of the separate Pro version. On first
activation you are shown an explicit opt-in screen; NOTHING is sent anywhere
unless you click "Allow & Continue" — choosing "Skip" keeps the plugin fully
functional with no data leaving your site. If you opt in, Freemius receives
basic site data (site URL, WordPress/PHP versions, plugin version, admin email)
to provide update notifications and support.
Freemius terms: https://freemius.com/terms/
Freemius privacy policy: https://freemius.com/privacy/

== Installation ==

1. Upload the `stocktake-for-woocommerce` folder to `/wp-content/plugins/`.
2. Activate the plugin through the **Plugins** menu in WordPress.
3. Go to **Stocktake** in the admin menu and create your first session.

WooCommerce must be installed and active.

== Frequently Asked Questions ==

= How do I do a physical stock count in WooCommerce? =
Start a stocktake session, then enter counted quantities by scanning barcodes and SKUs or by typing them in. Stocktake compares your count against a snapshot of expected stock and shows the variance for each product. When you are finished, one click adjusts WooCommerce stock to match, and your previous levels are backed up automatically in case you need to undo. This replaces editing each product's stock quantity one by one.

= Can I count while the store is open, or do I have to close it? =
You can count while the store stays open. Stocktake records a snapshot of expected quantities when the session starts, so ongoing sales during the count are handled against that baseline. Partial spot counts and cycle counts also let you check sections of the catalogue without pausing trading.

= Why is my WooCommerce stock wrong or showing incorrect stock levels? =
System stock drifts from reality for many reasons, including caching, variable-product stock quirks, bad CSV imports, and concurrent sales. A physical stock count is the most reliable way to bring your records back in line with what is actually on the shelf. That is what a stocktake does: count, review the variance, and reconcile in one click.

= What is a blind stock count and why would I use one? =
A blind count hides the system's expected quantity from the counter, so they record what they actually find rather than confirming the number on screen. This removes confirmation bias and produces a more honest count. Blind count is included free and can be toggled per session.

= How do I count inventory with a barcode scanner in WooCommerce? =
Connect a USB or Bluetooth barcode scanner and scan items to count them by barcode, SKU, or product name. Each scan counts the item on the spot. For smaller counts you can also use phone-camera barcode scanning, which is currently in Beta.

= Can I use my phone camera as a barcode scanner to count stock? =
Yes, phone-camera barcode scanning is available as a Beta feature and works well for small counts. For counting hundreds of items, a dedicated USB or Bluetooth scanner is faster and more reliable, and both are fully supported.

= How do I bulk update WooCommerce stock after a physical count? =
You do not need CSV round-trips or a bulk editor. After counting, one-click stock adjustment writes your counted quantities to WooCommerce. Before it applies, Stocktake backs up your current stock automatically, so a single undo restores the previous levels if something looks off.

= How do I see stock variance, and can it show inventory shrinkage in money? =
Stocktake shows the variance between counted and expected quantities for every product, and can express that variance in money when WooCommerce Cost of Goods data is set. Pro adds an accuracy and shrinkage trend so you can track how your count accuracy develops over time.

= How often should I do a stocktake versus a full inventory count? =
A common approach is to cycle count high-value items frequently, count mid-value items periodically, and run a full physical count at fiscal year-end. Stocktake supports both full or zero-based counts and partial spot cycle counts, and Pro adds scheduled reminders to keep the rhythm.

= Can I pause and resume a stock count? =
Yes. You can resume an unfinished count at any time, so a large stocktake can span breaks, shifts, or multiple days without losing progress.

= What is the difference between a quick stock check and a full stocktake? =
A full stocktake is a session-based count of many products with variance review and a one-click apply. The Pro quick stock check is for one-off fixes: scan any single product, correct its live stock on the spot, and have the change recorded in an audit log. Use stocktakes for periodic counts and quick checks for spot corrections.

= Can multiple people count at the same time? =
Yes, in Pro. Multiple counters can work with their contributions attributed to them, and a recount and approval workflow lets a supervisor review before stock is applied.

= Can I value my inventory with this plugin? =
Yes. Pro inventory valuation reports the value of your stock at both retail and cost, with a per-category breakdown. In the free version you can also see variance value when WooCommerce Cost of Goods data is set.

= What can I export? =
The free version exports count results, variance, and the reorder or low-stock shortlist to CSV. Pro adds branded PDF count sheets and Excel (XLSX) export.

= Does it work with product variations? =
Yes — each stock-managed variation is counted as its own line. Scanning a variation's barcode (its SKU or the WooCommerce GTIN/UPC/EAN/ISBN field) counts that exact variation, and applying updates that variation's stock.

= Which barcodes are recognised? =
A scanned code is matched against the SKU first, then against WooCommerce's own GTIN / UPC / EAN / ISBN product field (WooCommerce 9.2+). Both work for products and variations.

== Screenshots ==

1. All your stocktakes at a glance — start a count, resume an open one, and see the mode, progress, variance and value of every session.
2. Scan once — a recognised barcode is counted on the spot; correct any quantity on the editable list of what you just scanned.
3. Review every variance (expected vs counted, units and value), then apply the adjustments to WooCommerce in one click.
4. Free forever, Pro when you grow — a clear Free vs Pro comparison and simple annual pricing.
5. Blind counts and phone-camera barcode scanning, for counting without a handheld scanner.
6. An automatic restore point is saved before every apply — roll back any count at any time.

== Changelog ==


= 1.1.22 =
* The plugin is now listed as "Stocktake – Physical Inventory Count for
  WooCommerce" — the same plugin and the same install; only the display name
  is clearer about what it does. Listing and documentation refreshed.
* No functional changes.

= 1.1.21 =
A ground-up rework of the counting screen for real, non-stop scanning.

* One-scan counting: a recognised barcode — or a name-search pick, or a camera
  read — is counted the instant it resolves. No quantity prompt, no dialog, the
  cursor never leaves the scan box, so you scan one item after another at the
  pace of the scanner. First scan counts 1.
* Scan the same product again and it adds on top, in every mode, with a clear
  "5 + 1 = 6" note so an accidental double-scan can never pass unnoticed.
* Corrections moved to a big, editable panel for the item you just counted plus
  an editable list of recent scans: adjust a quantity with the +/− stepper
  (saved automatically) or remove a line entirely. No need to touch the screen
  at all if the default of 1 is right.
* A product that isn't in this count's list is simply added and counted when you
  scan it (you're holding it, after all) — with a quiet note, never a pop-up.
  A code that matches no product shows an inline message with the scanned code.
* Hardware scanners are recognised even when the cursor sits in a quantity
  field, and a barcode-sized quantity is refused — a stray scan is treated as
  the next item, not saved as a count.
* New REST endpoint and audit-log event for removing a count (Pro's session
  history shows these as "Count removed").
* Reliability: live-count reads are never served from a cache, and rapid or
  overlapping scans are processed in order so no count is lost or double-counted.

= 1.1.20 =
* Fix: the bundled ZXing barcode library is back in the package — a packaging
  step had been leaving assets/js/vendor/ out of the zip, which broke the
  phone-camera scanner's fallback decoder on iOS.
* Directory housekeeping for WordPress.org: escapes all admin output through
  wp_kses(), prepares every database query with placeholders, uses a more
  distinct internal PHP namespace, and drops directory image files and build
  metadata from the plugin package.
* Every Pro-only engine — the approval workflow, presets, scheduled
  reminders, stock-check access layer and the Pro report helpers — now ships
  exclusively in the separately distributed Pro build.


= 1.1.19 =
* Fix: Excel exports now declare a default cell style, so strict readers
  (e.g. openpyxl) no longer warn about a missing default style. The files
  always opened correctly in Excel; this makes them fully standard.
* Fix: a cancelled stocktake now shows "View" instead of "Count" in the list.
* Fix: the phone-camera scanner shows a clear message when the camera can't
  start (unsupported browser or insecure context) instead of doing nothing.


= 1.1.18 =
* WordPress.org review compliance: the free plugin now contains no Pro code
  at all — Pro-only counting modes and cost valuation live exclusively in
  the separately distributed Pro build (nothing is locked or gated).
* All admin JavaScript is enqueued via wp_enqueue_script (no inline tags).
* Documents the optional Freemius opt-in under "External services".


= 1.1.17 =
* Variable products: parent-level (pooled) stock is now counted correctly as one
  line; scanning any of its variations lands on that line, and per-variation
  SKUs can no longer count against the wrong sibling.
* Fix: a recount saved after "Apply" is now always pushed on the next Apply,
  while items whose count matched the records are never touched — sales made
  during the stocktake are preserved exactly.
* Reports: Pulse/Insights pages now stay fast and light on huge catalogues,
  exclude trashed products, respect the shop timezone, and exports stream
  any catalogue size without memory limits or skipped rows.
* History gains paging past 300 entries; goods-in sessions export the received
  quantity; presets are addressed by stable ids (stale tabs can no longer
  delete the wrong preset); many smaller fixes from the second code audit.


= 1.1.16 =
* Security & reliability: reject counting/adjusting draft or trashed products;
  validate quantities; guard against concurrent Apply double-counting stock;
  the auto-backup now aborts Apply if it can't be fully written.
* Fix: Undo now rolls back each Apply wave correctly; a failed save no longer
  freezes the counting screen; blind counts no longer leak expected quantities.
* Fix: comma decimals (12,5) are accepted; upgrade/activation edge cases,
  the count reminder after reactivation, and full data cleanup on uninstall.
* Adds a Cancel button to a stocktake; clearer export column and safer CSVs.


= 1.1.15 =
* Fix: the admin menu icon rendered as a plain white square on some
  colour schemes; the brand icon now displays in full colour.


= 1.1.14 =
* i18n: the checkout now opens in the plugin's selected language where
  supported (EN/ES/DE/FR/IT), with automatic detection elsewhere.

Older releases: see the changelog.txt file shipped with the plugin.
