How Gatemi Low Stock Works

The plugin does one thing: at the hour you chose, it reads your stock, works out what is low, and sends one email listing it. Three rules shape how it does that, and both editions keep all three.

The three rules

One number per product. A product's own Low stock threshold — WooCommerce's field on the product's Inventory tab, the one that already drives WooCommerce's own low-stock email — is the per-product threshold. There is no second box for it in this plugin. Two boxes would be two numbers that can disagree, and you would find out which one won from an email that did or did not arrive.

Nothing is sent when nothing is low. A scheduled email that keeps saying "nothing to report" teaches people to delete it unread — and then the day the list is long, that one is deleted too. (Full edition: a shop that wants the email either way can switch on Send it even when nothing is low.)

The list is built when it is sent. Nothing is recorded as products cross their threshold. A product restocked on Thursday is not on Friday's digest, because Friday's digest reads Friday's stock.

Step 1: which products are read

When the digest is due, and whenever the settings screen is opened, the plugin asks WooCommerce for published products that manage stock, 200 at a time, through WooCommerce's own product query. Products that do not track a quantity are never read and never listed — there is no number to compare.

A variation that manages its own stock is checked and listed on its own line, linked to the product it belongs to; a variable product that manages stock at product level is checked as one line. A variation that follows its parent's stock is not counted separately, so nothing is listed twice.

Nothing of this runs on a shopper's request. It is a scheduled task and an admin screen.

Step 2: the threshold for each product

For each product, the first of these that has a value is used:

  1. The product's own low-stock threshold (its Inventory tab).
  2. Full edition: the highest threshold among the product's categories, counting each category's parent categories too.
  3. The store-wide threshold on the Low Stock screen.
  4. WooCommerce's own low stock threshold (WooCommerce → Settings → Products → Inventory).

The free edition skips step 2 — it does not read category thresholds.

An empty box always means "not set, look further down"; 0 is a real threshold meaning "only once it has run out".

Why the highest category wins (full edition)

A product filed under two categories gets the more cautious threshold. Being told too early costs an email; being told too late costs a sale.

Worked example

You sell frozen food. In the full edition you set Frozen to 20 and leave everything else empty. WooCommerce's own threshold is 2.

  • Peas 1 kg, in Frozen → Vegetables, no threshold of its own: the sub-category inherits Frozen, so it is low at 20 or fewer.
  • Ice cream tub, in Frozen and Desserts (Desserts set to 10): the highest wins, so 20.
  • Ice lollies, in Frozen, with its own threshold of 50: the product's own number wins, so 50.
  • Napkins, in no category with a threshold: WooCommerce's 2.

In the free edition, the first two would use the store-wide threshold (or WooCommerce's 2 if that is empty), and Ice lollies would still use its own 50.

Step 3: low or not

A product is low when its stock quantity is at or below its threshold. It is out of stock when the quantity is 0 or less. A negative quantity (an oversold backorder) counts as out of stock.

Step 4: the order of the list

  1. Out-of-stock products first.
  2. Then the fewest left.
  3. Then alphabetically by name, so the same shop produces the same list twice running.

The top of the list is the money: what has already stopped selling.

Step 5: the digest

The email is plain text, one product per line, so it reads properly on a phone:

These products are at or below their threshold right now. 1 of them have run out.

OUT OF STOCK — Ice cream tub (ICE-500)
3 left (of 20) — Peas 1 kg (PEA-1KG)

The subject is {count} products are low at {site_title} with the numbers filled in. Full edition: you can write your own subject and opening; the list is always added underneath.

The free edition lists up to twenty products and ends with a line saying how many more there are. The full edition lists every low product found (by default, up to 500 per scan).

The email is sent to each recipient separately through wp_mail(), so it goes through whatever mail plugin or SMTP setup your site already uses.

Step 6: the schedule

The plugin keeps exactly one scheduled task (WP-Cron) while a digest is wanted, and removes it when the digest is switched off or there is no valid recipient. The first run is set to the next time the chosen hour comes round in the store's timezone, then it repeats daily (or, full edition, weekly).

WP-Cron runs when the site gets a visit. On a site with little traffic the email can arrive later than the hour; a real server cron calling wp-cron.php fixes that.

What the plugin does not do

  • It does not switch off WooCommerce's own per-product low-stock emails. That is WooCommerce's setting (WooCommerce → Settings → Emails).
  • It writes nothing to products or orders, and adds nothing to the storefront.
Shopping Cart
Scroll to Top