Replace the single is_free_member flag with a real member-tier system
Design doc §07 extension: admin-configurable tiers, each with an arbitrary JSON benefit set, instead of one hardcoded boolean. Ships two benefit types on top of the new Membership\Tier lookup: the existing free-shipping threshold (refactored, not just left on the old flag) and a new "$10 off orders $100+, members only" cart discount — bundling purchases into one $100+ order saves BooksRun's flat per-order shipping fee outright, more than covering the discount. Researched official/well-supported WooCommerce plugins first (Memberships, Points and Rewards, Smart Coupons) — none combine tiers with configurable per-tier benefit sets, so building custom on the existing wp_bsc_member table was the right call. Registration is enabled via WooCommerce's own native My Account signup (deploy.sh) rather than a bespoke form, with a marketing-consent checkbox added via the standard extension hooks. Admin management: new `wp bookstore tier-*` CLI commands plus a WooCommerce Settings screen (this plugin's first admin UI). Migration drops and recreates bsc_member rather than backfilling — pre-launch, only synthetic data exists anywhere. Live-verified beyond the unit suite: real migration run, CLI commands end-to-end, a real registration submitted through the actual WC form (with and without consent), and the settings screen edited/created/ deleted tiers through real authenticated form POSTs with real nonces. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MqhgnCRjjVLFnZ3Jpn93Vg
This commit is contained in:
1 parent
7023044278
commit
13e7362579
13 files changed
+930
-43
No files matched your search
@@ -129,6 +129,12 @@ echo "==> enabling WooCommerce HPOS (custom order tables)"
|
||||
$WP option update woocommerce_custom_orders_table_enabled yes
|
||||
$WP option update woocommerce_custom_orders_table_data_sync_enabled yes
|
||||
|
||||
# Membership\Registration hooks onto WooCommerce's own My Account
|
||||
# registration form (design doc §07) rather than a bespoke signup form —
|
||||
# it's disabled by default, so nothing shows up without this.
|
||||
echo "==> enabling WooCommerce account registration (member signup)"
|
||||
$WP option update woocommerce_enable_myaccount_registration yes
|
||||
|
||||
# WooCommerce's default (unset -> '1:1') force-crops every product
|
||||
# thumbnail to a square — confirmed directly: a 335x500 portrait book cover
|
||||
# was landing at a hard-cropped 300x300 shop-grid thumbnail, cutting off
|
||||
|
||||
Reference in new issue
Block a user