=== CatCode Loyalty Points & Cashback for WooCommerce ===
Contributors: catcodestudio
Tags: woocommerce, loyalty, points, cashback, rewards
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Cashback in points for completed orders and paying with points in the cart and at checkout — with expiry, a welcome bonus and a "My points" page.

== Description ==

A loyalty programme that behaves like money in the store's books: points are credited when an order is completed, spent as an ordinary discount line and taken back when an order is cancelled.

= How it works =

1. A customer places an order. When the order reaches the status you chose (Completed by default), a share of the goods value comes back as points: 5% of 1 000 is 50 points.
2. In the cart or at checkout the customer sees the balance and types how many points to use — or clicks "Use the maximum". The points become a negative fee "Paid with points (N)" in the totals, so the order, the invoice and a fiscal receipt show a normal discount, and taxes go down with it.
3. The points are taken from the balance the moment the order is placed. If the order is cancelled, refunded or its payment fails, they go back.
4. If a completed order is cancelled or refunded later, its cashback is taken back — only what the customer has not spent yet.

= Features =

* Cashback percent of the goods value (without tax and shipping, less coupons and points)
* Choice of order statuses that credit cashback and that take it back
* Minimum order for cashback
* Paying with points on the classic cart and checkout and on the Cart and Checkout blocks
* The value of one point and the largest share of an order points may pay
* Minimum order for using points
* Welcome bonus for new customer accounts
* Points expiry: every credit has its own term, the oldest-expiring points are spent first
* "My points" in My Account: balance, expiry date, full history
* "Points for this purchase: +N" on the product page and "This order will earn you N points" in the cart
* Customer balances in the admin with search, history and manual credit/debit with a comment
* Order notes for every movement of points
* A ledger of movements (never an edited number), so every point can be traced to an order
* HPOS (custom order tables) compatible

<!-- @pro-begin -->
= Pro =

* Customer levels by total spent (Silver from 5 000 — 7%, Gold from 20 000 — 10%), with the next level and the money still missing shown in My Account
* Delayed crediting: points of an order become spendable only after the return period
* Expiry reminders by e-mail and by Viber/SMS through TurboSMS, one message per customer
* CSV export of balances
* 7-day trial straight from the settings screen; a purchased licence keeps Pro on for good, the licence term covers updates and support

<!-- @pro-end -->
= Data =

The points ledger is stored in its own table and is kept when the plugin is deleted — customers' points are a promise the store made. Add `define( 'CATCODE_LOYALTY_DROP_DATA', true );` to wp-config.php before deleting the plugin to remove it too.

== Installation ==

1. Upload the plugin and activate it. WooCommerce must be active.
2. Open WooCommerce → Loyalty points, tick "Enable the loyalty programme" and set the cashback percent.
3. Save — the "My points" page appears in My Account.

== Frequently Asked Questions ==

= When are points credited? =

When the order reaches one of the statuses you selected — Completed by default. Processing is not recommended: the order may still be returned.

= Can a customer pay the whole order with points? =

Only up to the share you set (30% by default) of the goods total after coupons.

= What happens to the points when an order is cancelled? =

Points used in the order go back to the customer. Cashback credited for the order is taken back.

= Do guests earn points? =

No. Points belong to a customer account; the cart invites guests to log in or register.

== Changelog ==

= 1.0.0 =
* First release.
