=== Factorize Essentials ===
Contributors: webyoungstown
Tags: woocommerce, badges, checkout, liquidation, store
Requires at least: 6.2
Tested up to: 6.7
Stable tag: 1.0.1
Requires PHP: 7.4
License: Factorize License (proprietary)
License URI: https://factorize.webyoungstown.com/license/

WooCommerce essentials for liquidation and open-box stores: real percent-off badges, SAVE lines, condition and pickup notes, and checkout guards.

== Description ==

Liquidation, bin, and open-box stores sell trust as much as product. Shoppers need to know why the price is low, what "open box" actually means, and how pickup works — before they reach checkout and bail. Stock WooCommerce doesn't answer any of that: sale badges just say "Sale!", out-of-stock cards look buyable, a failed search is a dead end, and the fine print lives nowhere. Factorize Essentials is the store-wide behavior layer that fixes all of it. It was extracted from a theme built for a real 950-product liquidation store — every feature below exists because that store needed it.

= Features =

* **Real percentage-off sale flash** — the on-sale badge shows the actual discount ("-29%") instead of "Sale!". Variable products show the highest discount across their variations.
* **SAVE $x line** — simple products on sale get a "SAVE $12.50" badge right under the price, computed from the regular/sale gap.
* **Condition note** — a configurable disclaimer under every product summary (default: "New and unused — packaging may have slight dents, creases, or an open box.").
* **Pickup note** — a map-pin line under the buy box with a configurable bold title and small-print sub-line (default: "Pickup In Store — Free").
* **OUT OF STOCK badges** — unavailable products in the shop grid are labeled clearly instead of looking buyable.
* **"View Details" buttons** — loop buttons on out-of-stock items read "View Details" instead of "Add to cart".
* **Live cart badges** — an AJAX add-to-cart fragment keeps any "span.et-cart-count" element (header or bottom-bar cart icons) updated instantly, no page reload.
* **Checkout fine print** — the condition, as-is, and pickup disclaimers restated on the WooCommerce Blocks checkout, where they matter most.
* **Pickup-first checkout copy** — rewrites three shipping-centric WooCommerce core strings (e.g. "Delivery options will be calculated during checkout", "Billing and shipping address") for stores that mostly do local pickup.
* **Guest-checkout reassurance** — a note above the login form telling first-time visitors an account tracks orders, but none is needed to check out.
* **In-stock-only deal rows** — [products on_sale="true"] shortcode blocks show only in-stock deals, and subtract featured products so a "Hot Deals" row never repeats the "Featured" row above it.
* **In-stock-first related products** — related rows prefer in-stock items, top up from the product's own categories, and only fall back to out-of-stock picks as a last resort.
* **Brand chip row** — a horizontally scrollable, one-tap category filter row above the grid on shop and search pages (up to six product categories, ordered by their "order" meta).
* **Guided no-results page** — replaces WooCommerce's bare "no products found" notice with the shopper's query echoed back, a spelling nudge, and "Shop All Deals" / "Home" buttons.
* **Spacer-paragraph cleanup** — strips empty non-breaking-space and lone-line-break paragraphs (a common site-migration leftover) from descriptions and short descriptions at render time, without touching stored content.
* **Truncated-title ellipsis** — display-only "…" on product titles that a platform export hard-cut mid-word, so the cut reads as intentional instead of broken.
* **Double-tap protection** — re-adding a sold-individually item that is already in the cart becomes a quiet no-op instead of a red error.
* **Stale-notice shedding** — clears leftover session error notices on cart and checkout, so the Blocks checkout's Store API never rejects an order (HTTP 409) over an old notice.
* **Breadcrumb polish** — a clean "Home / Category / Product" delimiter.
* **Sidebar removal** — drops the WooCommerce sidebar for full-width shop layouts.

= Works standalone, better together =

Factorize is a modular WooCommerce toolkit for liquidation, bin, discount, and open-box stores, built and battle-tested on a real 950-product store. Every plugin works completely standalone; any of them alone stands up the shared "Factorize" admin hub, and together they fill it with category tabs (Insights / Selling / Customers / Storefront). Installing Factorize Essentials by itself creates the full hub with its card on the Storefront tab; other Factorize plugins simply add their own cards and tabs whenever you install them.

= Configuration =

There is no settings screen in 1.0.0 — the storefront changes are live on activation, and three text strings are configurable in code:

* `condition_note` — the disclaimer under the product summary. Default: "New and unused — packaging may have slight dents, creases, or an open box."
* `pickup_title` — the bold first line of the pickup note. Default: "Pickup In Store — Free"
* `pickup_sub` — the small-print second line. Default: "Free local pickup — or flat-rate shipping at checkout."

Override any subset by saving an array to the `factorize-essentials_options` option, or filter the merged array at runtime with the `factorize-essentials_config` filter. Per-string filters (`empire_tools_condition_note`, `empire_tools_pickup_title`, `empire_tools_pickup_sub`) apply on top of the configured values. The plugin writes no product meta, order data, or custom tables; uninstalling deletes its option and nothing else.

= Roadmap =

Planned for future releases — not yet in this version:

* Per-category condition notes
* Badge style presets and designer
* Editable checkout fine-print from the admin
* Payment trust-badge row
* Admin notice log viewer

== Installation ==

1. Upload the `factorize-essentials` folder to `/wp-content/plugins/`, or install it through Plugins → Add New → Upload Plugin, then activate it.
2. Make sure WooCommerce is installed and active — Factorize Essentials is inert without it (it activates cleanly and simply does nothing).
3. Look for the new **Factorize** menu in wp-admin: Essentials registers its status card under the Storefront tab. There is nothing to configure there — the storefront changes are already live.
4. Visit an on-sale product on the front end. You should see the percentage-off flash, the SAVE line, and the condition and pickup notes under the buy box.
5. First thing to change: the pickup and condition wording. Save your own strings to the `factorize-essentials_options` option, e.g. via WP-CLI: `wp option update factorize-essentials_options '{"pickup_title":"Pickup at Our Warehouse — Free"}' --format=json`
6. If badges and notes render unstyled, add CSS for the plugin's classes (`et-save-badge`, `et-oos-badge`, `et-condition-note`, `et-pickup-note`, `et-brand-chips`, `et-no-results`, `et-checkout-fineprint`, `et-cart-count`) — the plugin outputs classed markup and leaves the look to your theme.

== Frequently Asked Questions ==

= Does it work without the other Factorize plugins? =

Yes. Every Factorize plugin is fully standalone. Essentials alone stands up the Factorize admin hub; other plugins add their own cards and tabs if you install them later. The only cross-plugin awareness is subtracting featured product IDs from on-sale shortcode rows, and that step silently skips when nothing has marked products as featured.

= Does it work without WooCommerce? =

It activates cleanly but does nothing — every hook checks for WooCommerce first, so there are no errors and no output on a non-WooCommerce site.

= Does any data leave my server? =

No. The plugin makes no external requests, loads nothing from CDNs, and phones nothing home. Everything is generated on your server at render time.

= Where do the settings live, and what happens on uninstall? =

Everything lives in a single WordPress option, `factorize-essentials_options` (a legacy `empire-store-essentials_options` option is read as a fallback). The plugin writes no product meta, no order data, and no custom tables. Uninstalling deletes both options and nothing else.

= How do I change the condition or pickup wording? =

Save any subset of keys to the option — `update_option( 'factorize-essentials_options', array( 'condition_note' => 'Your wording.' ) )` — or filter the merged config at runtime with `factorize-essentials_config`. The per-string filters `empire_tools_condition_note`, `empire_tools_pickup_title`, and `empire_tools_pickup_sub` also still apply on top.

= Can I edit the checkout fine print? =

Not from the admin yet. In 1.0.0 the checkout note's wording is fixed in code and still carries the copy written for the original store (pickup address included), so changing it means editing or removing the `render_block` filter in `factorize-essentials.php`. An admin-editable fine print is on the roadmap.

== Screenshots ==

1. Product page with the real percentage-off flash, the SAVE badge under the price, the condition note, and the free-pickup line under the buy box.
2. Shop grid showing OUT OF STOCK badges, "View Details" buttons on unavailable items, and the brand chip filter row above the products.
3. The guided no-results search page: the query echoed back, a spelling nudge, and "Shop All Deals" / "Home" buttons.
4. WooCommerce Blocks checkout with the appended fine-print note.
5. The Factorize admin hub, Storefront tab, showing the Essentials status card.

== Changelog ==

= 1.0.0 =
* Initial release.
* Real percentage-off sale flashes, SAVE $x lines, and OUT OF STOCK badges.
* Condition, pickup, and checkout fine-print trust notes, plus pickup-first checkout copy.
* In-stock-only on-sale shortcode rows and in-stock-first related products.
* Guided zero-results search page, brand chip row, and spacer-paragraph cleanup.
* Double-tap add-to-cart protection and stale checkout-notice shedding.
