Generate a WooCommerce loyalty points plugin
Loyalty programs almost always outgrow the generic plugin that the shop initially installs. Your marketing team wants "double points on birthday week". The accountant wants points redemption to show as a discount line on the invoice, not a random negative total. Repeat customers should auto-advance into a VIP tier at €500 lifetime spend, and that tier should get a different redemption ratio. Each of these is trivial individually; together they make a generic plugin feel wrong.
A generated loyalty plugin is built around your exact earning and redemption rules. We create a points ledger table, wire the earn events to the order-status transitions you care about, and generate the redemption flow — either as a coupon, a checkout option, or a gift card style balance — that matches how your shop thinks about rewards.
Why generate it instead of installing an existing plugin?
YITH WooCommerce Points and Rewards (€79-129/year) and Points and Rewards for WooCommerce (€99/year) are both serviceable. They handle the common cases and come with an admin UI that exposes every configuration. The friction appears in the tail: you cannot easily say "bonus points if the order includes item X", or "different redemption ratio for wholesale customers", or "points expire 12 months after earning" without either writing code on top or buying a higher tier.
Loyalty data is also a customer data moat worth owning. A custom plugin stores the points ledger in your own DB, accessible via your own REST endpoints for mobile apps or loyalty kiosks. Nothing goes through a third-party SaaS.
We find most shops never use more than 4-6 earning rules and 2-3 redemption patterns. A focused plugin doing those 8-9 things well, with an admin page that shows only those 8-9 things, is lighter to maintain than a generic plugin with 30 rule types, 20 of which are unused.
Example prompt
This is the kind of description that generates this plugin. You can start from it and tweak whatever you need before hitting generate.
Plugin name: Acme Loyalty
Earning:
- 1 point per 1 EUR spent (net of VAT) on completed orders.
- 2x points during the customer's birthday week (birthday stored in user meta).
- +50 bonus points on the first order.
- Points added to the ledger when the order reaches status "completed"; removed if refunded.
Redemption:
- 100 points = 1 EUR discount.
- Redemption via a checkout block: "Use X points (you have Y available)" slider.
- Applies as a discount line (not a coupon) so it is auditable on the invoice.
- Minimum 500 points to redeem.
Tiers:
- "Bronze" (default).
- "Silver" at 500 EUR lifetime spend (1.25 points per 1 EUR going forward).
- "Gold" at 2000 EUR lifetime spend (1.5 points per 1 EUR).
Points expiry: 18 months after earning, sweep via daily cron.
Admin:
- Customer list with their points balance + tier.
- Per-customer manual adjust (add/subtract with a reason).
My Account tab "Rewards" shows balance, history, upcoming expiries.
HPOS-compatible. Ledger table: acme_points_ledger (id, user_id, delta, reason, order_id, created_at, expires_at).What the generated plugin typically includes
- Custom DB table (ledger) with dbDelta on activation and schema version option
- Hooks into woocommerce_order_status_completed and refund flow
- Checkout block extension to show the slider via Store API register_endpoint_data
- My Account custom endpoint rendering the history with pagination
- Admin list table (WP_List_Table) showing all customers with balance + tier
- Daily cron sweeping expired points + lifetime spend recalculation
- HPOS-compatible order reads throughout
Add referral bonuses, social share points, review-for-points, tier gifts — describe the mechanic and the plugin implements it.
Frequently asked questions
Will customers see their balance on the site?
Yes, in their My Account area and optionally via a shortcode [acme_points_balance] you can drop anywhere (eg. in the header). Balance is also available via a REST endpoint if you have a mobile app.
What happens to points on refund?
By default the plugin reverses the earned points when the order moves to refunded. If you prefer a grace period or a policy where points stay for full refunds only, describe it and the plugin reflects that.
Can I migrate points from an existing plugin?
Yes, if you can produce a CSV with user_id and current_balance, we add an import command (WP-CLI or admin tool) that seeds the ledger with a single "migration" entry per user. History from the old plugin is not preserved unless exportable.
How does it work with HPOS?
The ledger has its own table (not order post meta). We reference orders via order_id column, and all reads of WC order data use $order->get_meta() / wc_get_order(). HPOS is declared in before_woocommerce_init.