=== Tich Courses for WooCommerce ===
Contributors: tichcourses
Tags: woocommerce, courses, lms, enrollment
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
WC requires at least: 8.0
WC tested up to: 11.1
Stable tag: 1.0.10
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Turns a paid WooCommerce order into course access on Tich, automatically.

== Description ==

A customer who buys a product mapped to a Tich course gets access and a
sign-in link by email the moment the order is paid, with no manual step.
The plugin stores no passwords and creates no accounts itself: every action
goes through Tich's public API (https://tich.courses/developers), with one
API key per course site.

The plugin's admin interface follows the WordPress admin language, with
translations delivered from translate.wordpress.org.

Full guide, including FAQ: https://tich.courses/integrations/woocommerce

== Installation ==

1. Plugins → Add New → Upload Plugin → choose the zip → Install → Activate.
2. WooCommerce → Tich: paste an API key (created in the Tich dashboard, on
   the course site's card → "Enrollment automation" → "Create key") and
   click "Connect".
3. On each product: the Tich box in the product editor's sidebar → pick a
   course site, a course and an access type.

== External services ==

The plugin talks to Tich's public API (https://api.tich.courses, or
https://api.tich.foo for a development key, one starting with tich_test_), the
service that hosts the course sites. Without it the plugin has nothing to
do. What is sent, and when:

* When a key is connected and on every load of the settings page (and at
  most once a day on other admin pages): the API key, to confirm it is
  still valid and which course site it belongs to.
* When editing a product: the key, to load the list of courses and access
  types to choose from.
* When an order is paid or completed, and on the manual order actions: the
  customer's billing email address, the course id and the access type id,
  to open access and send a sign-in link. On a full refund (if that setting
  is enabled) and on manual revocation: the email and the course id, to
  revoke access.

Nothing else from the store is sent: no names, no amounts, no addresses.
Tich logs each of these calls in the course site's own log (kept for 90
days) so that "she paid, why no access?" can always be answered.

* Terms of use: https://tich.courses/terms
* Privacy statement: https://tich.courses/privacy
* API documentation: https://tich.courses/developers
* Service website: https://tich.courses

== Frequently Asked Questions ==

= The customer typed a wrong email at checkout and received nothing =
Fix the email on the order (edit billing details), then run the order
action "Tich: grant access to the courses in this order + send sign-in
link".

= The order is paid, but the order notes say opening access failed =
Read the code in the note (key revoked, course deleted,
or Tich unreachable), then run the order action "Tich: grant access to the
courses in this order + send sign-in link".

= I refunded an order. What happens to the access? =
By default access is revoked: the setting "Revoke access automatically when
an order is fully refunded" on WooCommerce → Tich is on out of the box (it
can be turned off there). A partial refund never revokes access. Access can
always be revoked manually from "Manage access" on the course site, or with
the order action "Tich: revoke access to the courses in this order
(without notifying the customer)".

= I have several course sites =
One key per site, on the settings page. On each product row you pick which
site it belongs to.

= I created a new API key in the Tich dashboard =
On WooCommerce → Tich: add a row, paste the new key and click "Connect".
The plugin recognises it is the same course site and replaces the old key
in place. Products already mapped to that site keep working unchanged.

= A product with variations =
The mapping lives on the parent product. Every variation opens the same
access.

= How do I update the plugin? =
Download again from https://tich.courses/integrations/woocommerce and
install over the existing version. The current version is shown in the
settings page's "Help" tab.

= The email from Tich did not arrive =
Check the spam folder, then run the order action "Tich: grant access to
the courses in this order + send sign-in link".

== Changelog ==

= 1.0.10 =
* The plugin is now "Tich Courses for WooCommerce", with the WordPress.org slug
  tich-courses (folder tich-courses/, text domain tich-courses) - a new
  plugin's slug needs at least 5 letters, so tich itself can't be one. If
  you installed an earlier version from a zip: deactivate the old one,
  install and activate this one (the settings and keys carry over), and
  only then delete the old tich/ folder over FTP or in the file manager.
  Do not delete the old one from the WordPress Plugins screen, since that
  runs its uninstall.php and deletes the settings and keys.
* No more "Environment" setting: each key's own prefix decides whether it
  talks to Tich (tich_live_) or to Tich's development environment
  (tich_test_). A store that was set to development with live keys also
  saved will now use those live keys too.
* A course site connected with a development key (tich_test_) is labeled
  "(development)" after its name everywhere in the plugin.
* Translations now come from translate.wordpress.org instead of being
  bundled in the plugin. Until the Hebrew translation is published there,
  the admin interface is shown in English.

= 1.0.9 =
* The plugin is now translatable: its strings are in English in the code,
  with a bundled Hebrew translation (languages/). The admin interface
  follows the WordPress admin language - a site or user profile set to
  Hebrew sees exactly the same Hebrew as before; any other language sees
  English.

= 1.0.8 =
* The order note for an enrollment past the course site's student quota (but
  not yet locked) now says so specifically, instead of using the same
  wording as an actually-locked site.

= 1.0.7 =
* The plugin slug is now tich (folder tich/, main file tich.php, text
  domain tich), ahead of publishing on the WordPress.org plugin directory.
  If you installed an earlier version from a zip: install the new one,
  activate it, and only then remove the old one. Do not remove it from the
  WordPress Plugins screen, since that runs the old version's uninstall.php
  and deletes the settings and keys. Deleting the tich-woocommerce/ folder
  over FTP or in the file manager keeps everything in place.
* A notice on every WordPress admin page when a connected key has stopped
  working (revoked on the Tich side, or lacking the permission to open
  access), with a button to fix it on the plugin's settings page. Detection
  is cheap: every call the plugin already makes to Tich updates the status,
  plus one check per site per day, only when an admin loads an admin page.
  Opening the settings page checks immediately and resets that clock.
* readme: External services section (what is sent to Tich and when), Tested
  up to raised to WordPress 7.1 and WooCommerce 11.1, and the whole file is
  now in English per the plugin directory's readme policy.
* A failed revocation is logged in the order notes as "revoking access
  failed" rather than "opening access failed".
* Plugin Check: translators comments on every string with placeholders,
  sanitized reads of the submitted settings rows and the product mapping
  JSON, and no direct database query in uninstall.php.

= 1.0.6 =
* The same course site can no longer be connected twice: the same key pasted
  again (or two old rows for the same site) is merged into one row on save,
  with a notice explaining why.
* Key rotation: a new key pasted in a new row for an already-connected site
  replaces the old key in place, without deleting the old row first.
* Deleting a key (disconnecting) saves the settings right after the
  confirmation, with no extra "Save settings" click that was easy to forget.
  The button on a connected row is now "Delete secret key to disconnect".
* The revoked-key notice links straight to that course site's integrations
  panel in the dashboard and names the site.
* The "Settings saved" notice no longer shows next to an error about a key
  that was not saved.
* On the product page, when a site's course list fails to load (revoked key,
  or Tich briefly unreachable), the row shows "could not load" in yellow
  instead of "course no longer exists" in red. The mapping itself is kept.
* An order whose payment is reported twice (webhook + status change) is no
  longer queued twice.
* The admin failure email is sent again if a new failure happens after the
  previous one was resolved, instead of only once per order.
* "Revoke access" for a site that is no longer connected records an order
  note instead of silently doing nothing.
* Wording: order notes speak of "opening access" rather than "registration",
  without gendered forms; the locked-site notice now explains itself (access
  opens once the lock is lifted).

= 1.0.5 =
* When an already-connected API key is deleted or revoked on the Tich side,
  the site's row on the settings page shows an explicit yellow warning with
  a direct link to create a new key in the Tich dashboard, instead of a
  filled field and a useless "Connect" button (the field is locked and the
  button hidden in that state).
* The "Disconnect from store" button on a row that is not connected reads
  "Delete": there is nothing to disconnect.
* The "Disconnect"/"Delete" button is no longer shown on an empty row.
* Plugin renamed to "Tich for WooCommerce".

= 1.0.4 =
* The link to the Tich settings page after a plugin update also appears
  when the update is done by uploading a zip over the existing version (not
  only via "Update available" on the plugins list).

= 1.0.3 =
* A more detailed connection error when a key is not found, instead of
  "unknown_error".
* The "Disconnect from store" button moved to the end of the site row,
  after the connection status.
* Fixed the centering of the "+" icon on the add-site button.
* A direct link to the Tich settings page after a plugin update.

= 1.0.0 =
* First release.
