=== 5bucks – Loyalty Points and More for WooCommerce ===
Contributors: kmakris
Tags: loyalty points, points and rewards, cash on delivery, cod fee, cost of goods
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 8.2
Stable tag: 0.7.0
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Loyalty points, a cash on delivery fee, GDPR requests and product costs for WooCommerce: small modules, each off until you need it.

== Description ==

5bucks is a set of small modules for a WooCommerce shop: loyalty points, a cash on delivery fee, privacy requests
and product costs. Each one does one job, is switched on from its own page under the **5bucks** menu, and costs
nothing while it is off. Switch on only what your shop needs.

= Loyalty points =

A complete points programme, with no limits on members or points: reward your customers with points they can spend
at checkout for an amount off. Customers earn points on paid orders, at the rate you set for every amount spent,
guests included: a guest's points follow their order's email address, and come to their account once WooCommerce
confirms that address (WooCommerce 11 or later; otherwise staff merge the two on the Members screen). Once you switch
spending on, customers with an account spend them on the classic checkout and the block checkout alike, and a refund
gives them back.

Customers see what a product, the cart and their order earn; the points an order earned on its thank-you page and in
its emails, with a link to a balance page that needs no login; and their points and history under My Account >
Points, where they can also stop earning. Staff find every member, with their balance and history, adjust points with
a reason, merge two members, and export the members and every points movement as CSV. Start in shadow mode, which
records points on real orders while customers see nothing, then switch to live.

= Cash on delivery fee =

Charge a fee when the customer pays cash on delivery with one of the shipping methods you tick on your site's
list, leaving out store pickup or parcel lockers, say. The fee appears the moment cash on delivery is chosen and
goes when another method is, on the classic checkout and on the block checkout alike, and it is charged exactly
when the order is paid cash on delivery. You choose the amount, its label, whether VAT is added, or whether the
amount already includes it. It works with WooCommerce's own Cash on delivery method. A cart with nothing to ship
gets no fee, and neither do orders created or edited in wp-admin, or one paid later from its payment page.

= Privacy requests =

A tab in the customer's My Account area where they ask for a copy of their personal data or for its erasure,
as the GDPR allows them to. No forms to build and no email addresses to check: the request is for the logged-in
customer's own account, confirmed by email, and handled with WordPress's own privacy tools. Every text is
yours to write.

= Product costs =

Record what you pay for each product: a wholesale price and a supplier SKU, on simple products and on every
variation. The product editor shows the profit (as a markup on cost, or a margin on price, with or without
VAT). Already keep these values from a theme or another tool? Point the module at their field names and it
reads them as they are, with nothing copied.

= Built to stay out of the way =

* **A module that is off costs nothing**: its code does not run at all.
* **A failing module is contained.** An error in a module never takes the shop down: it is logged, and a module
  that keeps failing switches itself off and tells you, with a Re-enable button.
* **No calls to outside services** from your shop's pages. Nothing is sent anywhere.
* **Classic and block checkout**, both tested, on the default WordPress theme and a popular commercial one.
* **Your menu, your way**: rename the 5bucks menu item, move it, change its icon or its colour under 5bucks >
  Settings.

WooCommerce is needed by every module: without it, they cannot be switched on.

= 5bucks Pro: more modules, 5 bucks a year =

An add-on to this plugin, sold separately. Each of its modules is switched on from its own page and costs nothing
while it is off.

**Sell more**

* **Promotions**: discounts that advertise themselves. Quantity discounts such as 15% off from 8 items, each with
  a schedule and a priority; a box in the cart and checkout telling customers how many more items reach the
  discount, a bar across the top of the shop and a line on product pages. Shadow mode shows on real orders what a
  discount would give before anyone gets it.
* **Loyalty**: more for the loyalty programme above. Earning rules, such as a first-order bonus, points per
  category, product or date, or multipliers; rewards, claimed or issued as codes and emailed; points that expire
  after the months you choose, with warnings first; a reminder to customers who have gone quiet; guests who earn less
  than account holders and spend their points with a code emailed to them; past orders credited; and reports.
* **Messages**: the emails 5bucks modules send, done right. Listed with WooCommerce's own emails, to edit, preview or
  switch off; sent from a background queue that tries again, with a log of what went to whom. Marketing goes only
  to past customers, with a one-click unsubscribe.

**Know your numbers**

* **Margin report**: what your discounts really cost. The margin each coupon and discount gave away, from the
  wholesale prices you enter with Product costs, with each new order's costs recorded, so a later price change never
  rewrites the past.
* **PostHog analytics**: see what shoppers do, step by step. Your shop's WooCommerce events, from product views to
  completed orders, with session replay and feature flags.

**Run the shop**

* **Invoice or receipt**: let business customers ask for an invoice, on the classic and the block checkout. An
  invoice needs a company name and a VAT ID, and Greek VAT IDs are checked.
* **Order columns**: columns in the orders list from any field your orders store, such as where each was placed,
  with your own labels for its values.
* **eMAG feed**: your margins in the eMAG marketplace feed. A price markup, and your supplier SKUs as MPN, in the
  product feed your eMAG feed plugin builds.

**5 bucks a year. Every Pro feature, including future ones.** Your money back within 30 days if it isn't for you,
no questions asked.

= Source code =

Everything in the plugin is readable source, except the admin stylesheets in `assets/dist/`, which are built
with Tailwind CSS 4 from `assets/src/` and the class names in `src/` and `templates/`. To rebuild them from the
plugin's folder: `npx @tailwindcss/cli -i assets/src/admin.css -o assets/dist/admin.css --minify` (and the same
for `menu.css`). The scripts in `assets/js/` are shipped as written, with no build step.

== Installation ==

1. In wp-admin, go to **Plugins > Add New**, search for 5bucks, and click **Install Now**, then **Activate**.
2. Open **5bucks** in the admin menu. The sections menu on the left lists every module.
3. Open a module, check its settings, switch **Enabled** on and click **Save changes**.

Requires PHP 8.2 or newer and WordPress 6.5 or newer. The modules need WooCommerce 9.0 or newer.

== Frequently Asked Questions ==

= Does a module that is off slow my shop down? =

No. A module that is off is never loaded, and a module that is on only loads its settings and scripts on the
pages that use them.

= What happens if a module breaks? =

It is stopped, never the shop. Each error is logged (WooCommerce > Status > Logs) and listed on 5bucks >
Modules. If a module fails five times in ten minutes it is switched off automatically, and a notice in wp-admin
says so, with a Re-enable button once you have fixed the cause.

= Does it work with the block checkout? =

Yes. The cash on delivery fee and loyalty points work on both WooCommerce's classic checkout and the block checkout
that a new WooCommerce installation creates. The privacy requests tab works with any theme, since it uses WooCommerce's
own My Account styles.

= Does it send any data anywhere? =

No. The plugin makes no calls to outside services from your shop's pages, and collects nothing.

= Can I change where the menu item is, or what it looks like? =

Yes, under 5bucks > Settings: its label, its icon, its colour and its position (after Settings, at the top, or
any position you choose).

= What does 5bucks Pro add? =

Discounts that advertise themselves, earning rules, rewards, expiry and reminders for the loyalty programme, the
emails 5bucks modules send, analytics, a margin report and more: see 5bucks Pro above. Without it, or without its
licence, the loyalty programme keeps running as this plugin has it. It is an add-on: this plugin keeps working the
same with or without it.

= Where do I get help? =

On this plugin's support forum. 5bucks is looked after by one person, so answers come as time allows, without a
promised response time. Bugs are fixed in updates. Please include your WordPress, WooCommerce and PHP versions, and
what you expected to happen. Questions about 5bucks Pro go through **5bucks > Contact Us**, which 5bucks Pro adds, not
this forum.

== Screenshots ==

1. The cash on delivery fee's page, naming the shipping methods that go without the fee.
2. The cash on delivery fee on the block checkout, shown as soon as the customer chooses cash on delivery.
3. Privacy requests: the tab in the customer's My Account area.
4. Product costs: the wholesale price and the profit in the product editor.
5. 5bucks > Settings: the menu item's label, icon, colour and position.
6. 5bucks > Modules: how many modules are on, and what 5bucks Pro adds.
7. Loyalty points: a customer's points and history under My Account > Points.

== Changelog ==

Before 0.6.0, the first version on wordpress.org, only the versions that changed this plugin are listed.

= 0.7.0 =
* Now called 5bucks – Loyalty Points and More for WooCommerce.
* The 5bucks Pro panel says it costs 5 bucks a year.
* Loyalty points: every customer earns on paid orders, guests included, and members spend their points at checkout,
  with a balance page, My Account > Points and a members screen for staff. Customers can stop earning from their points
  pages. A few figures from your points, worked out every night, on its settings page. Off until you switch it on.
* Settings export and import on 5bucks > Settings: every setting in one file.
* A support report: Copy for support on 5bucks > Modules, and a 5bucks section in Site Health and WooCommerce > Status.
* Says which WooCommerce versions it works with: 9.0 or later, tested up to 11.1.
* Settings screens: each setting's name and description on the left, the setting itself on the right.
* Loyalty's settings speak plainly: short names, an example in each help, a line on what each tab is for, and what
  customers see grouped by where they read it.
* A module's page shows the plugins it needs as badges beside its status.
* The Loyalty and Product costs pages end with a card saying what 5bucks Pro adds to them, until it runs with its
  licence.

= 0.6.1 =
* The plugin's wordpress.org page shows a changelog of its own.

= 0.6.0 =
* First release on wordpress.org.
* Cash on delivery fee: tick the shipping methods that get the fee, zone by zone, from your site's own list,
  instead of typing the IDs of those without it. Settings saved the old way are moved on the first wp-admin visit,
  so every fee stays as it was.
* Every 5bucks screen draws its tables, tabs, buttons and badges the same way.
* The menu's first page is called Modules, and Settings is always in the menu.
* The 5bucks Pro panel on the Modules page lists everything 5bucks Pro adds, a card each for selling more, knowing
  your numbers and running the shop.
* Saving a module's page while switching it on or off shows one notice, not two.
* Fix: a number setting stored outside its bounds some other way than its form (WP-CLI, an import) reads as its
  default.

= 0.5.4 =
* The Overview's 5bucks Pro panel gives its price, $5, and says the money back is within 30 days.

= 0.5.3 =
* What modules and add-ons put on the 5bucks screens is printed through an allowlist of admin HTML: no scripts,
  style elements or event handlers.

= 0.5.0 =
* The 5bucks menu always lists its first page first, also once a module adds a page of its own.
* The Overview's 5bucks Pro panel has a Get 5bucks Pro button.

= 0.4.1 =
* Fixes: a settings error quoting what was typed shows it as text, and a module error recorded late in a page load
  no longer drops the errors recorded meanwhile.

= 0.4.0 =
* Fixes and hardening: Product costs refuses a meta key WooCommerce keeps its own product data under; no cash on
  delivery fee on a cart with nothing to ship, and a sturdier fee on the block checkout; a module that fails while
  starting stays off and says why, and one that cannot describe its settings no longer locks wp-admin; the sections
  menu marks the modules that are on.

= 0.3.2 =
* First release as 5bucks: the cash on delivery fee (classic and block checkout), privacy requests and product
  costs modules, a sections menu, 5bucks > Settings for the menu item, and a translation template. A module that
  needs WooCommerce can no longer be switched on without it.
