=== Factorize Perks ===
Contributors: webyoungstown
Tags: woocommerce, membership, loyalty, discounts, perks
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/

A paid-member flag for WooCommerce: percentage cart discount, flat-rate shipping credit, and a product-page pitch that sells the upgrade.

== Description ==

Repeat customers keep a liquidation store alive, but a full membership platform is overkill when all you actually need is a way to reward the people who pay for an upgrade. Factorize Perks keeps it simple: one "Paid member" checkbox on the WordPress user profile, and every perk turns on the moment you check it. There is no billing engine and no member portal to maintain — you collect the subscription however you like (in store, by invoice, over the phone) and flip the flag. Built for a real liquidation store, where the free tier is simply any registered account and the paid tier is one checkbox away.

= Features =

* **Paid-member flag** stored as plain user meta (`et_member_paid`), toggled by a "Paid member" checkbox on the WordPress user profile screen. Only users with the `manage_woocommerce` capability (shop managers and admins) can see or change it.
* **Automatic member discount** — a configurable percentage (default 5%) off the cart subtotal for paid members, applied as a clearly labeled negative fee ("Member discount (5%)") so it works on regular items and Buy Now purchases alike.
* **Member shipping credit** — a configurable dollar amount (default $10) subtracted from every flat-rate shipping cost for paid members, floored at $0. The rate is relabeled so the shopper sees the perk: "Shipping — free for members (up to $10)" when it hits zero, "Shipping — $10 member discount applied" when it does not.
* **Product-page member pitch** — non-members viewing auction-type product pages see a one-line nudge listing the perks, with a link to My Account that reads "Join free" for visitors and "Ask about upgrading" for logged-in free members. Paid members never see it.
* **Free tier by design** — any registered account counts as a free member; only the paid flag gates the perks, so there is nothing extra to set up for regular customers.
* **Developer helper** — `empire_tools_is_paid_member( $user_id )` and the `EMPIRE_TOOLS_PAID_META` constant let your theme or sibling plugins check paid status with one call.
* **Factorize hub card** — registers a card on the Customers tab of the shared Factorize admin hub, showing the live discount percent and shipping credit at a glance.
* **Clean uninstall** — deleting the plugin removes only its own options; the member flags on user accounts are deliberately kept, so reinstalling restores every member instantly.
* **Nothing leaves your server** — no external services, no API calls, no tracking. Everything is user meta and one WordPress option.

= 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). Factorize Perks lives on the Customers tab. WooCommerce is required for the perks themselves — the discount, shipping credit, and product-page pitch all run on WooCommerce hooks.

= Configuration =

Two keys drive the numbers, read through `empire_perks_config()`:

* `discount_pct` (default `5`) — percent off the cart subtotal for paid members; also shown in the fee label.
* `shipping_credit` (default `10`) — dollars subtracted from each flat-rate shipping cost for paid members, floored at $0; also shown in the shipping labels.

Override either key by saving an array to the `factorize-perks_options` option (the legacy `empire-membership-perks_options` option is still read as a fallback), or filter the merged config with the `factorize-perks_config` filter. There is no settings screen in 1.0.0 — configuration is by option or filter.

= Roadmap =

Planned for future releases — none of these ship in 1.0.0:

* Stripe subscription billing (automated recurring charges that set the same paid-member flag the checkbox sets today)
* Multiple member tiers
* Points multiplier events
* Member-only products
* Birthday rewards
* Referral credits

== Installation ==

1. Upload the `factorize-perks` folder to `/wp-content/plugins/`, or install the zip through Plugins → Add New → Upload Plugin, then activate it.
2. Make sure WooCommerce is active. Without it the plugin only defines the flag helpers — the discount, shipping credit, and pitch never fire.
3. A "Factorize" menu appears in the admin sidebar. Open it and find the Factorize Perks card on the Customers tab, showing the current discount and shipping credit.
4. Flag your first member: go to Users, edit the customer's profile, check the "Paid member" box, and save. Collect their membership payment however you normally take money — the plugin does not bill anyone.
5. Verify it works: log in as that customer and add a product to the cart. The cart shows a "Member discount (5%)" line, and flat-rate shipping drops by $10 (down to free).
6. To change the numbers, save an array to the `factorize-perks_options` option or hook the `factorize-perks_config` filter — for example `update_option( 'factorize-perks_options', array( 'discount_pct' => 10 ) );`.

== Frequently Asked Questions ==

= Does this plugin bill my members? =

No, and that is deliberate. The paid tier is a manual flag: you collect the subscription in store, by invoice, or however you like, then check the box on the user's profile. Stripe subscription billing is on the roadmap, and because the whole paid tier is one piece of user meta, the future billing flow only needs to set the same flag.

= Does it work without the other Factorize plugins? =

Yes. Factorize Perks is fully standalone — installed alone it stands up the entire Factorize admin hub with its one Customers card. Other Factorize plugins can call its `empire_tools_is_paid_member()` helper when present, but it calls nothing from them.

= Where does the data live, and does anything leave my server? =

Everything stays in your WordPress database: one user meta key (`et_member_paid`) per member and one option (`factorize-perks_options`) for overrides. No external services are contacted and no data leaves your site. Uninstalling deletes the plugin's options but keeps the member flags, so no member history is lost.

= How do I change the 5% discount or the $10 shipping credit? =

Save an array to the `factorize-perks_options` option (for example `array( 'discount_pct' => 10, 'shipping_credit' => 15 )`) or hook the `factorize-perks_config` filter. The cart fee, the fee label, and the shipping labels all follow your values. Note one 1.0.0 limitation: the product-page pitch and the profile checkbox description are fixed copy that still reads "5%" and "$10".

= Why isn't the shipping credit applying? =

The credit only targets shipping rates whose method is Flat rate (`flat_rate`) — free shipping, local pickup, table rates, and other methods are left untouched. Also confirm the shopper is logged in and their profile has the "Paid member" box checked.

= Does it include a points system? =

No. The perks pitch mentions points because the store this was built for pairs it with a separate, independently installed points plugin (Points and Rewards for WooCommerce) that handles earning and redeeming. Factorize Perks itself only provides the flag, discount, shipping credit, and pitch.

== Screenshots ==

1. The "Paid member" checkbox on the WordPress user profile screen, where a shop manager turns the paid tier on or off.
2. The cart for a paid member, with the "Member discount (5%)" line reducing the subtotal.
3. Checkout shipping for a paid member, relabeled "Shipping — free for members (up to $10)".
4. The member pitch a non-member sees on an auction product page, with the "Join free" link to My Account.
5. The Factorize admin hub's Customers tab, with the Factorize Perks card showing the live discount and shipping credit.

== Changelog ==

= 1.0.0 =
* Initial release.
* Paid-member flag with a shop-manager checkbox on the user profile screen.
* Configurable percentage cart discount for paid members (default 5%), applied as a labeled negative fee.
* Configurable flat-rate shipping credit (default $10), floored at free, with member-facing labels.
* Product-page perks pitch shown to non-members on auction products.
* Shared Factorize admin hub with a live-status card on the Customers tab.
