=== Australcode Loyalty Program, Points and Rewards for WooCommerce ===
Contributors: australcode
Tags: loyalty, loyalty program, points and rewards, reward points, points
Requires at least: 6.5
Tested up to: 7.0
Requires PHP: 8.2
Stable tag: 1.2.0
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Loyalty points for WooCommerce: earn on every order, redeem from a wallet — no coupon codes. Switching from YITH? Import your balances.

== Description ==

Australcode Points and Rewards is a loyalty plugin for WooCommerce with one design goal: a points program that stays fast and predictable as your store grows. Every customer gets a points wallet backed by dedicated, append-only ledger tables, and they redeem points at checkout straight from that balance — no coupon codes to manage. Customers earn on every order and you control earning, redemption and display from a clean WordPress admin.

Switching from another loyalty plugin? A built-in importer migrates your customers' point balances from **YITH WooCommerce Points and Rewards** — from the admin or with a WP-CLI command, dry-run included.

**Free features**

* Earn points on every order, at a rate you choose, awarded when the order is processing or completed.
* Per-product and per-category earning multipliers, and per-product/category exclusions.
* Redeem points straight from the wallet for a cart discount — no coupon code is generated — with a minimum-to-redeem and a max-percentage-of-cart cap.
* Redeem from the cart itself — in the classic cart and in the block-based cart, where the redeem field sits in Cart totals next to the coupon field.
* "Earn X points" message on product pages and in the cart.
* My Account rewards area with balance, lifetime totals and history.
* Optional floating points widget.
* Custom point labels (e.g. "stars"), accent color and an opt-in dark mode.
* Shortcodes and Gutenberg blocks — balance, history, "earn X points" message and redeem box (`[acrwd_balance]`, `[acrwd_history]`, `[acrwd_earn_message]`, `[acrwd_redeem]`) — place them anywhere, including Elementor, Bricks or Divi layouts.
* **Import from YITH WooCommerce Points and Rewards** — admin importer plus a `wp acrwd import yith` WP-CLI command, both with a dry-run preview, to migrate customer balances when switching.
* Program dashboard — points in circulation, a 30-day trend and your top earners at a glance.
* CSV export of customers with their balances.
* Earning controls: rounding mode, exclude items on sale, and guest orders linked to the customer's points once they register.
* Developer-friendly: `acrwd_*` actions and filters to wire points into your own logic.
* Fully translated into Spanish (es_ES and es_CL), so Spanish-speaking stores get the whole plugin in their own language.
* HPOS-compatible (WooCommerce High-Performance Order Storage).
* Built on custom tables for fast, scalable reads — no autoloaded option bloat.

**Pro features** (unlocked with a license)

* Extra earning bonuses: signup, daily-login streak, first order, approved review, birthday, profile completion, order-count milestone, cart-total threshold and lifetime-spend milestone.
* Earning rules engine: multipliers or flat bonuses by category, customer role, order total and date range, applied first-match by priority, with a one-click dry-run preview over recent orders.
* Advanced redemption: spend points on rewards you define — a fixed-amount coupon, a percentage discount, free shipping or a free product of your choosing — single-use, with restrictions, expiry and an automatic refund if a coupon goes unused.
* Unlimited VIP tiers with per-tier earning multipliers, storefront badges (colour + icon) and a My Account progress bar, plus time-boxed campaigns ("double points weekend").
* Two-sided referral program: customers share a link and both sides earn on the friend's first order.
* Pro customer management: bulk add/subtract/expire, CSV import of adjustments with a dry-run preview, and block/unblock customers.
* Dedicated transactional emails: a points-expiry reminder and an optional manual-adjustment notice (standard WooCommerce emails).
* Points expiration with a configurable window.

[Get Pro &rarr;](https://points-rewards.australcode.io)

== Installation ==

1. Upload the `australcode-points-rewards` folder to `/wp-content/plugins/`, or install it from the Plugins screen.
2. Activate the plugin through the "Plugins" menu in WordPress. WooCommerce must be active.
3. Go to **Australcode Rewards → Settings** to configure earning, redemption and display options.
4. (Pro) Go to **Australcode Rewards → Upgrade** to buy or activate a Pro license — checkout and activation are handled in-dashboard by Freemius, and you can manage the license later under **Australcode Rewards → Account**.

== Screenshots ==

1. Dashboard — points in circulation with a 30-day trend, top earners and who is active right now, all from a fast custom-table ledger.
2. My Account rewards area — customers see their balance, redeem points straight onto the current cart (no coupon code involved) and review their full earn/redeem history.
3. Settings — configure earning, redemption and display, with inline guidance and a recommendation for each non-obvious option.
4. VIP tiers — reward your most loyal customers with higher earning multipliers (Pro).
5. Customers — per-customer balances and activity, all read from fast custom tables.
6. Campaigns — schedule limited-time earning multipliers, like a double-points weekend, that stack on your base rate (Pro).
7. Import — migrate your customers' point balances from YITH WooCommerce Points and Rewards, with a dry-run preview before anything is written.

== External services ==

This plugin uses Freemius to handle Pro licensing, checkout and plugin updates.
Freemius is the Merchant of Record for the Pro plan.

* **What it does:** Freemius powers the in-dashboard pricing/checkout for the Pro
  plan and, once you own a license, activates and validates it so Pro features
  can be unlocked on this site. It also serves automatic updates for the Pro
  build.
* **What data is sent and when:** if you opt in on the activation screen, basic
  non-sensitive environment data (site URL, WordPress/PHP versions, active
  plugin/theme) is sent to api.freemius.com to support licensing and updates.
  Opt-in is optional — a **Skip** button is shown, and the free version is fully
  functional without it. When you buy or activate a Pro license, your license
  key and site identifier are sent to validate it. No personal data of your
  store's customers is sent.
* **Beyond the support links below, the service is only contacted for
  licensing/updates of the Pro plan** (and only after opt-in). The free version
  does not require contacting any external service to work.
* **Support links:** the plugin menu includes a "Support Forum" link (to the
  plugin's forum on wordpress.org) and a "Contact Us" link that opens the Freemius
  support form in a new browser tab. The address of that link carries your site
  URL, your site's login URL, the wp-admin page you opened it from, and this
  plugin's ID, public key and version — so that information reaches Freemius when
  you click the link, before you type anything. If your site is connected to
  Freemius (opt-in), a signed site identifier is included too. If you then fill in
  and submit the form, your name, email address and message are sent to Freemius
  so they can route the request to us.

Service provider: Freemius, Inc.
Terms of Service: https://freemius.com/terms/
Privacy Policy: https://freemius.com/privacy/

== Frequently Asked Questions ==

= Does this plugin require WooCommerce? =

Yes. Australcode Points and Rewards extends WooCommerce and will show a notice if WooCommerce is not active.

= Is it compatible with High-Performance Order Storage (HPOS)? =

Yes. It uses the WooCommerce order CRUD API and declares HPOS compatibility.

= How are points stored? =

In dedicated custom tables (balances and an append-only transaction ledger), so reads stay fast as your store grows.

= Can customers spend points on any order? =

You set the redemption rate, a minimum number of points required to redeem, and the maximum percentage of a cart that can be paid with points.

= Can customers redeem points at checkout? =

Yes — that is the default. The redeem box sits in the cart and in the My Account rewards area, and the points come straight off the order total, like a payment. Nothing generates a coupon code you then have to send, chase or clean up.

= Does it work with the block-based Cart and Checkout? =

Yes, and the redeem field is in the cart itself in both. In the block-based cart it sits inside Cart totals, next to where coupons go; in the classic cart it sits above the totals. The My Account rewards area works with both as well, and the points come off the order total either way.

= When do points expire? =

Never, by default. With a Pro license you can set an expiration window; points are then swept by a daily task.

= I'm switching from YITH WooCommerce Points and Rewards — can I migrate? =

Yes. The plugin ships a dedicated YITH importer: an Import page in the admin and a `wp acrwd import yith` WP-CLI command, both with a dry-run preview. It reads your customers' existing balances and writes them into the plugin's ledger, so nobody loses their points when you switch.

= How is this different from other WooCommerce loyalty plugins? =

A few deliberate choices set it apart:

* **Redeem from a wallet, not a coupon.** Customers spend points directly at checkout — no auto-generated coupon codes to manage or clean up.
* **Built on custom tables, not user meta.** Balances and history live in dedicated, append-only ledger tables, so reads stay fast as your customer base grows.
* **Generous free tier.** Earning with per-product and per-category rates, wallet redemption, the My Account area, product/cart messaging, shortcodes and blocks, the YITH importer and dark mode are all free; Pro adds automation (an earning-rules engine, bonus events, VIP tiers, campaigns, referrals and expiration).
* **Clean, focused admin.** A single, uncluttered settings area rather than a sprawl of options.

= Can I restyle the rewards surfaces to match my theme? =

You mostly don't have to. The customer-facing surfaces inherit your theme: text color, fonts and the hairlines/backgrounds derive from whatever the surrounding page is using, so they follow a light or a dark theme on their own. Where a block theme publishes a brand color (`primary`, `accent` or `accent-1`), it is picked up too.

To go further, add CSS variables on `.acfk.acrwd-scope` — the class every rewards fragment carries:

`.acfk.acrwd-scope { --acrwd-accent: #b3005e; }`

* `--acrwd-accent` — accent for figures, the tier multiplier, the progress bar and the focus ring. Also settable without code in **Settings → Display**. Leave it unset and the theme's own brand color is used.
* `--acrwd-fg` — text color for the rewards surfaces. Unset means "inherit from the page", which is almost always what you want.
* `--acrwd-muted` — secondary text: the points value under a balance, timestamps in the history table, help lines. Unset inherits from the page at reduced emphasis.
* `--acrwd-border` — the hairlines around cards and between history rows.
* `--acrwd-surface` — the card background behind the balance, the redemption list and the history table.
* `--acfk-radius`, `--acfk-gap`, `--acfk-hairline`, `--acfk-wash` — corner radius, spacing and the neutral lines/backgrounds shared by every Australcode plugin on the storefront.

The last three are the same four variables the built-in dark mode sets, so if you are theming a dark surface on a light theme you can set them directly instead of enabling dark mode.

The floating widget keeps its own fill (`--acrwd-accent`, or the plugin's green) rather than inheriting the theme's, because it carries text on top and an inherited color cannot be checked for contrast in advance.

= Which actions and filters can I hook into? =

The full catalogue, with argument lists, is on the plugin's Help screen (Rewards → Help). Hooks marked (Pro) fire only when the Pro version is installed; the rest are in the free version:

Filters:

* `acrwd_earning_multiplier` — ( int $points, int $user_id, WC_Order $order ) — stack an extra multiplier on top of the base and per-role amounts.
* `acrwd_role_earning_multiplier` — ( float $multiplier, int $user_id, string[] $roles ) — customise the per-role earning multiplier.
* `acrwd_earning_bonus_points` — ( int $bonus, int $user_id, WC_Order $order ) — add flat bonus points after every multiplier has been applied.
* `acrwd_order_earned_points` — ( int $fallback, WC_Order $order ) — read what an order earned (the ledger amount once awarded, otherwise a preview), to show the figure on your thank-you page.
* `acrwd_account_endpoint` — ( string $endpoint ) — change the My Account "Rewards" endpoint slug.
* `acrwd_enqueue_frontend` — ( bool $should ) — force-load the storefront CSS where the plugin cannot detect its own output, which happens with some page builders.
* `acrwd_tier_label` — ( string $label, string $tier_id ) — supply the display label for a VIP tier if you render tiers yourself.

Actions:

* `acrwd_points_earned` — ( int $user_id, WC_Order $order ) — fires after an order's points are awarded.
* `acrwd_points_adjusted` — ( int $user_id, int $points ) — fires after you adjust a balance by hand; the points are signed.
* `acrwd_myaccount_after_summary` — ( int $user_id, Balance $balance ) — fires in the My Account "Rewards" tab after the balance summary, so you can add your own panel.
* `acrwd_tier_changed` (Pro) — ( int $user_id, ?Tier $tier ) — fires when a customer's VIP tier changes; `$tier` is null when they drop below the lowest one.
* `acrwd_email_points_expiring` (Pro) — ( int $user_id, int $points, string $expires ) — fires per customer when the expiry reminder runs, to send your own notification.

= Do you offer support? =

Free users can ask questions in the WordPress.org support forum. A Pro license includes email support — write to info@australcode.io and we'll help you get your rewards program running.

== Changelog ==

= 1.2.0 =
* The plugin now appears in your Plugins list as "Australcode Loyalty Program, Points and Rewards for WooCommerce". Only the display name changed — your settings, points, ledger and history are untouched, and nothing needs reconfiguring.
* Fixed: on the free version, saving Settings no longer switches off "Only reward reviews from verified purchases". That option is configured on Pro, and because its checkbox is not part of the free download, every save on free quietly reset it — so a store that moved between builds could start paying review points for unverified reviews without any sign that anything had changed.
* Fixed: after buying Pro, the plugin no longer calls you a free user while you wait to install the Pro download. The dashboard said "License: Free" and the menu offered "Upgrade" to someone who had already paid; it now says the license is active and points you at the download.
* Fixed: on Pro, the "Manage license" button went to the pricing page — offering to sell you what you already own. It now opens your account.
* Fixed: the Settings screen no longer opens scrolled past its own tab bar, which hid the five tabs behind the WordPress toolbar and dropped you into the middle of the form.
* Fixed: the free version no longer shows two "Upgrade" entries in the plugin menu.
* Improved: Settings now warns you before you leave with unsaved changes, instead of discarding them silently.
* Improved: the Campaigns, Earning rules, Redemption rewards and Referrals tables now show status as a colour-coded badge instead of plain text — and a campaign whose dates have passed reads "Ended" rather than "Paused", so you can tell a campaign you paused from one that simply finished.
* Improved: a customer with no points yet now sees how to earn some, with your store's actual earning rate, instead of a bare "No points activity yet."
* New: you can now redeem points directly in the block-based cart. Until now that cart only showed a notice telling you to go to My Account, which meant leaving the cart, finding the Rewards page, applying, and coming back — five steps at the moment you had already decided to buy. The redeem field now sits in Cart totals, next to the coupon field, exactly like the classic cart. The amount you can redeem updates on its own when you change quantities.
* Fixed: the rewards list in My Account was indented out of line with the rest of the panel — noticeably so on a phone, where it took up a tenth of the width.
* Improved: the admin screens now use the shared Australcode interface components throughout — form fields, dropdowns, help text and tables. Rows are tighter, fields respond to hover and focus instead of changing state in a hard jump, and the tables read the same on a phone as the rest of the plugin.
* Updated the Freemius licensing library to 2.13.4.

= 1.1.0 =
* Pro: a new reward type — give a free product. Pick any product and customers can spend their points on it; they get one unit free at checkout, with the usual expiry and restrictions.
* Fixed: after buying Pro, the free version no longer presents Pro as already active. Between the purchase and installing the Pro download, the plugin recognized the license and switched everything on — the dashboard reported "License: Pro" and the settings screen offered Pro options that saved but never took effect, because the Pro code is not part of the free download. The plugin now waits until the Pro version is actually installed before unlocking anything.
* Pro: the Referrals screen no longer asks you to wait for activity when the referral program is switched off. Both referral bonuses ship at 0, and while they are, customers are never shown a link to share — so no referral could ever appear. The screen now says so and links to the setting.
* Fixed: buttons across the admin screens were missing their keyboard focus outline, making the plugin hard to navigate without a mouse. Every button now shows a visible focus ring.
* Fixed: the CSV file picker on the Customers screen no longer overflows its panel on a phone.

= 1.0.3 =
* Added: a "Support Forum" link in the plugin menu, pointing at the plugin's support forum on WordPress.org.
* Improved: the License screen now shows what your Pro plan includes instead of an empty page, and the license box no longer overflows on narrow phones.
* Fixed: the admin menu entry reads "License" once Pro is active, instead of still inviting you to upgrade.

= 1.0.2 =
* Pro: the birthday field in My Account → Account details now saves. It never did: the field and its security token shared one name, so the token was overwritten by the date and the save was rejected without any error message — no customer could record a birthday, and the birthday reward never reached anyone. Clicking the field's label now focuses it, too.

= 1.0.1 =
* Fix: redeeming points now lowers the cart total by exactly the points' value in tax-inclusive stores. Previously the discount was inflated by the tax rate (e.g. it removed an extra 19% on top), because WooCommerce taxes negative fees. The redemption fee is now applied tax-free, so points settle the tax-inclusive total like a payment.

= 1.0.0 =
* Pro: advanced redemption — let customers spend points on rewards you define: a fixed-amount coupon, a percentage discount or free shipping. The plugin generates a single-use coupon they apply at checkout (classic or block-based).
* Pro: each reward has its own points cost, validity period, optional restrictions (minimum order, exclude sale items, specific categories) and a shareable/personal toggle.
* Pro: points are refunded automatically if a generated reward coupon expires without being used.

= 0.11.0 =
* Pro: earning rules — automate points with a multiplier (e.g. 2× points) or a flat bonus when an order matches conditions you set: product category, customer role, minimum order total and an active date range.
* Pro: rules run by priority — the first matching rule applies — and include a one-click “Test” that previews how a rule would have behaved over your recent orders.

= 0.10.0 =
* Pro: dedicated email that reminds customers their points are about to expire, a configurable number of days before (works with points expiration).
* Pro: optional email to a customer when you manually adjust their points from the Customers screen (off by default; bulk and CSV imports do not send it).
* Both emails are standard WooCommerce emails — enable, disable and customise them under WooCommerce → Settings → Emails.

= 0.9.0 =
* Customers: export your customers and their points balances to a CSV file (free).
* Pro: block or unblock a customer — a blocked customer stops earning and redeeming (manual admin adjustments still apply).
* Pro: bulk actions over selected customers — add points, subtract points, expire all points, or block/unblock.
* Pro: import a CSV of points adjustments (customer, points, reason), with a preview (dry run) before applying.
* Customers list now shows each customer's tier when VIP tiers are active.

= 0.8.0 =
* Pro: VIP tiers now have a colour and an optional icon, shown as a badge on the storefront.
* Pro: customers see a progress bar toward their next tier in the My Account Rewards area (and via the [acrwd_tier] shortcode/block), with how many points are left to reach it.

= 0.7.0 =
* Pro: new bonus — reward customers for completing their profile (name, phone and billing address).
* Pro: new bonus — reward customers when they reach a number of orders (e.g. their 5th order).
* Pro: new bonus — reward orders whose total reaches an amount you set, on every qualifying order.
* Pro: new bonus — reward customers when their lifetime spend crosses an amount.

= 0.6.0 =
* New: round earned points down, to the nearest, or up — your choice (down by default, so points never exceed the rate).
* New: award points on more than one order status — tick Processing as well as Completed if you award as soon as payment clears.
* New: choose whether points are earned on the price after coupons (default) or on the full price before coupons.
* New: option to skip products that are already on sale when calculating points.
* New: stop earning points on the part of an order paid for with redeemed points ("no points on points"), on by default.
* New: credit a customer's earlier guest orders when they create an account, matched by email (off by default).

= 0.5.0 =
* New: set the earning rate as a plain "for every X spent, give Y points" — no decimals to decode.
* New: a Messages tab to rewrite the storefront wording customers see (product, cart, redeem and order-email messages), in your own language.
* New: show the cash value of a customer's points balance in My Account and the [acrwd_balance] shortcode.
* New: choose where the "earn points" message appears on the product page.
* New: in-app Help (shortcodes, blocks, REST API and developer hooks) and Import (from YITH) admin pages.
* New: full Spanish (Chile and Spain) translations.

= 0.4.0 =
* New: a "Display & Widgets" settings tab to turn each storefront surface on or off (product message, cart message, My Account Rewards tab, order email, floating widget), plus the floating widget's corner.
* New: per-role earning multipliers are now a compact add/remove list instead of one row per role.
* New: shortcodes and matching Gutenberg blocks for the points balance, history, "earn X points" message and the redeem form — with attributes — so page builders (Elementor, Bricks, Divi) and the block editor can place them anywhere. Pro adds [acrwd_tier] and [acrwd_referral].
* Pro: a Referrals admin report shows who referred whom and how many converted, and the "Refer a friend" link gains a one-click Copy button.
* Fix: the customer search box no longer clips its placeholder text.

= 0.3.2 =
* Compliance: the free version no longer bundles the Pro feature code. VIP tiers, campaigns, two-sided referrals, bonus points (signup, daily login, first order, approved review, birthday) and points expiration now ship only in the Pro version. The free version is fully functional on its own.
* Admin: the menu icon now loads its CSS through the standard WordPress enqueue system.

= 0.3.1 =
* Maintenance: removed the "More by Australcode" cross-promotion section from the Upgrade screen.

= 0.3.0 =
* Admin: the customer points history and the locked Pro previews for tiers and campaigns now collapse to readable cards on mobile, matching the rest of the admin.
* Admin: refreshed admin styling — a sticky save bar on settings, clearer button states and responsive section headers.
* Maintenance: streamlined the plan model to Free and Pro, and refreshed bundled dependencies.

= 0.2.0 =
* Admin: edit existing tiers and campaigns in place (previously delete-and-recreate).
* Admin: the menu now shows the product glyph and full name, with inline guidance on the tier and campaign forms.
* Admin: the tiers and campaigns tables now collapse to readable cards on mobile, so the multiplier and edit/delete actions stay reachable on small screens.
* Frontend: the balance and history blocks now load their styles on any page (block-aware asset loading).
* i18n: complete es_CL and es_ES translations, including the Australcode family screen.

= 0.1.0 =
* Initial release: free earning (global rate + per-product/category overrides), redemption, My Account rewards, product/cart messages, floating widget, custom labels, dark mode, shortcodes and HPOS support.
* Pro: signup/daily-login/first-order/review/birthday bonuses, two-sided referrals, points expiration, unlimited tiers and campaigns, licensing via Freemius.

== Upgrade Notice ==

= 1.2.0 =
Adds redemption directly in the block-based cart, so customers no longer leave the cart to spend points. Fixes a bug where saving Settings on the free version switched off a Pro review setting. The display name changes — display only, nothing to reconfigure. No breaking changes.

= 1.1.0 =
Adds a free-product reward (Pro) and fixes the free version presenting Pro as active after a purchase, before the Pro download is installed — settings you set there never took effect. Also restores the keyboard focus outline on admin buttons. No breaking changes.

= 1.0.3 =
Adds a "Support Forum" link to the plugin menu and fixes the License screen, which showed an empty page to Pro owners. No breaking changes.

= 1.0.2 =
Pro: fixes the birthday field in My Account, which silently failed to save. If you offer a birthday reward, update — until now no customer could record a birthday for it. No breaking changes.

= 1.0.1 =
Fixes redemption discounts being inflated by the tax rate in tax-inclusive stores. No breaking changes.

= 0.4.0 =
New Display & Widgets settings, shortcodes and blocks for every rewards surface, a Pro referrals report, and UI fixes. No breaking changes.

= 0.3.2 =
Pro-only features now ship only in the Pro version; the free version stays fully functional. Internal compliance and styling fixes.

= 0.3.0 =
Mobile-friendly tables across the admin and refreshed styling. No breaking changes.

= 0.2.0 =
Edit tiers and campaigns in place, block-aware asset loading and complete es_CL/es_ES translations.

= 0.1.0 =
Initial release.
