=== Jeet Sanwal Backorder Update Note ===
Contributors: jeetsanwal
Tags: woocommerce, backorder, product, availability, stock
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.1.1
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Show a short merchant update on eligible WooCommerce backorders. Explicit public enable, optional site-date expiry, classic stock output and a shortcode fallback.

== Description ==

“Available on backorder” answers one question. A useful note can answer the next one.

Jeet Sanwal Backorder Update Note adds a dedicated place for a merchant-written update beside a simple product or an individual variation. Examples include a factual supplier update or an expected dispatch statement you have checked yourself. It does not calculate a restock date, promise delivery, or change whether an order can be placed.

* One latest note per supported product or variation, up to 300 characters of plain text.
* Public display starts disabled and must be deliberately enabled.
* Optional last display date, inclusive in the WordPress site timezone.
* Automatic suppression when the record is disabled, expired, not public, or not on backorder for one unit.
* The native WooCommerce availability-text filter preserves the existing availability text and appends an escaped Merchant update label.
* Shortcode fallback: [jeet_backorder_note] in product context or [jeet_backorder_note id="123"].
* Dedicated administrative save with a current nonce, product-state token and ownership-checked short-lived save claim.
* Small product/variation candidate batches, with native edit access checked before product fields and parent variation information.

Created by Jeet Sanwal — https://jeetsanwal.in

== Installation ==

1. Install and activate WooCommerce 8.0 or newer on a compatible WordPress installation. Your active WooCommerce release may have higher WordPress/PHP requirements than this plugin's syntax minimum.
2. Upload this plugin's individual ZIP through Plugins > Add New > Upload Plugin, install it and activate it.
3. Open WooCommerce > Backorder notes. Use a supported product/variation ID or browse the permitted candidate batches.
4. Write a single-line public note. Choose an optional last display date and explicitly enable public display, then save.
5. Check a published, passwordless backordered product using your normal storefront template. Purge relevant caches. If the template does not call the availability filter, place the documented shortcode in an appropriate supported location.

== Scope and important limits ==

Supported records are native simple products and individual variations. Variable parents, grouped/external products and custom product types are not supported note records. Each variation needs its own record; parent notes are never inherited. Both the variation and its parent must be published and passwordless for public output, and the parent must be publicly viewable.

Public output uses a fresh product read and is_on_backorder(1). That is a one-unit availability check, not an estimate for the quantity someone selected, the cart, a mixed order or a shipment. WooCommerce still controls inventory, purchasability and checkout. Expiry hides a note after its last display date according to the WordPress site timezone; an already expired note can be saved and remains visible to authorized staff as Expired. No cron task is needed.

The WooCommerce availability-text hook is used by standard classic stock output and variation responses that call it. Custom themes, Product Details blocks or other output may not call that hook; use the shortcode where appropriate. The shortcode applies the same visibility, backorder and expiry checks. The plugin does not load public scripts or styles.

The catalog picker shows each permitted item's note state and last display date. Filter the current batch by no valid note text, disabled, enabled/unexpired or expired. Enabled in this private list describes the saved note setting and date only; it is not proof that the note is currently public or that stock is on backorder.

The catalog picker examines 25 unfiltered candidate IDs plus one lookahead per batch, then applies supported-type, object-access and literal name filters. Next is based on candidate IDs, not a global matching total. An empty filtered batch is not proof that no later match exists. Up to 1,000 candidate batches are supported; an exact permitted ID can be opened directly.

== Permissions and storage ==

The administrative screen requires manage_woocommerce and edit_products. Opening/saving a record additionally requires the native edit_post permission for that product; variations also require edit permission for the parent before its private fields are read. Product editors see a read-only link to the separate form, avoiding nested product forms.

Each record is stored as protected product metadata under _jeet_bun_record. It contains the enabled flag, public note, expiry, last reviewer ID, UTC save time and a revision token. Public output returns only the intended note. Reserved-prefix metadata is excluded from this plugin's WooCommerce REST product/variation responses, and generic REST writes to it are rejected. Existing metadata-ID updates require the plugin's management and object-edit authority to inspect protected IDs; this can reject ID-based metadata changes from custom REST roles without that authority. Use the dedicated form for this record.

Save claims coordinate this plugin's dedicated saves for up to two minutes. Expired claims can be reclaimed without deleting a newer owner. An open form checks the saved note, publication state and recorded stock/backorder properties, including the parent stock state for variations. Direct writes by trusted administrative tools, other plugins, imports or the database are outside this coordination. After a save error, reopen and inspect the latest stored record before retrying; a storage confirmation error can occur after a write.

The note is meant for shoppers. Do not enter credentials, private supplier terms or customer data. Trusted administrative tools, database exports and backups can contain the complete metadata. Hiding output cannot recall cached pages, copied text or screenshots. Follow your normal page/CDN cache process when notes, stock, dates or visibility change.

With optional installation reports off, no external service, account, telemetry, email, checkout modification or order access is included. The latest records are retained after deactivation/uninstall for recovery; the plugin does not run a destructive uninstall cleanup. Normal WooCommerce product deletion can remove its product metadata.

== Updating an existing installation ==

Download the latest individual ZIP from https://jeetsanwal.in/tools/jeet-backorder-update-note . Keep a normal site backup and test on staging. Upload the newer ZIP through Plugins > Add New > Upload Plugin and choose Replace current with uploaded. Do not delete/uninstall as an update step. Check the displayed version, reopen a representative note and verify supported public output plus any page cache.

Updates are manual. The Update URI prevents replacement by an unrelated directory plugin; it is not an automatic update service. Replacing files with a previous ZIP can roll back code, but restoring database records requires your site backup. Support: https://jeetsanwal.in/plugin-support . Custom work is separate and does not lock included features.

== Frequently Asked Questions ==

= Does it predict a restock or delivery date? =
No. The merchant writes and maintains the statement. It is not a carrier estimate, shipping promise or purchase-order system.

= Will the note appear on every storefront template? =
Only output that calls WooCommerce's availability-text filter receives the automatic note. Custom templates/blocks may need the shortcode. Check your actual product and variation workflow.

= Does one parent note cover every variation? =
No. Open the actual variation ID and save its own note. A variable parent is not a supported note record.

= Will the note show while the product is in stock? =
No. Both automatic and shortcode output require is_on_backorder(1), an enabled unexpired record and the documented public states.

= Is the expiry date inclusive? =
Yes. The note can display through that calendar date in the WordPress site timezone. It is hidden afterward when output is requested, subject to normal page-cache behavior.

= Is everything free? =
Yes. All included features are free under GPL-2.0-or-later, without ads, a signup, a premium tier or a visitor-facing credit link. Install newer individual ZIPs manually.

== Optional installation reports ==

Installation reports are optional and OFF by default. Installing, activating, or using this product does not submit a report. Administrators can choose consent separately for each product under Settings > Jeet Sanwal Reports. All product features remain available with reporting off.

After explicit consent, the client sends the website URL, a random installation ID, product/WordPress/PHP versions, reported state, and an observed activation timestamp when available to https://jeetsanwal.in/api/v1/plugin-reports. While that product is active and consent remains enabled, a daily WordPress cron check-in can update its last-known status. WP-Cron depends on site traffic and hosting; it is not a continuous monitor.

Pause stops future reports without deleting records already shared. Forget requests deletion of the remote installation entry and history, retrying deletion if delivery fails. Records automatically expire after 90 days without a check-in. The plugin does not send page content, files, database exports, administrator email addresses, or raw IP addresses. Server rate limiting keeps a keyed IP hash for up to 24 hours; ordinary hosting access logs are governed separately by the privacy policy.

Review the fields and consent before enabling reporting. Read https://jeetsanwal.in/privacy for the reporting endpoint, retention, and deletion details. Reporting does not authorize remote control, automatic updates, or access to the website.

== Changelog ==

= 1.1.1 =
* Updated the product display name to Jeet Sanwal Backorder Update Note and retained the Jeet Sanwal author website.
* Added voluntary installation/status reports with per-product consent OFF by default, pause/forget controls, and documented fields and retention.
* Preserved existing identifiers, stored data, permissions, and earlier release history.


= 1.1.0 =
* Added note-status and last-display-date columns plus a note-status filter inside each permitted candidate batch.
* Fixed literal apostrophe/backslash name filtering in WordPress requests.


= 1.0.0 =
* Initial release with explicit merchant notes, one-unit backorder gating, optional site-date expiry, dedicated private records and classic availability/shortcode output.
