=== Click A Tree ===
Contributors: melsen
Tags: tree planting, carbon offset, sustainability, climate, checkout
Requires at least: 6.4
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 0.1.3
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Let customers add a real tree to their order at checkout. You keep the margin, Click A Tree plants the tree.

== Description ==

Click A Tree adds a simple "plant a tree" upsell to your WooCommerce shop. Customers can add one or more
real trees to their cart or checkout. The customer pays for the tree, you keep a margin, and Click A Tree
plants the tree and takes care of the certificate.

The plugin is deliberately thin. It handles the storefront and admin side inside your shop; the actual
planting, accounting and certificates run on the Click A Tree service (this is a Software-as-a-Service
model, see "External services" below). A free Click A Tree account and an API key connect the two.

= What the plugin does in your shop =

* Adds a hidden, virtual "tree" product (price configurable, default 5.00). One item = one tree.
* Shows an "add a tree" widget in both the classic and the block based cart and checkout.
* Reports paid orders that contain trees to Click A Tree so the trees get planted (HMAC signed request).
* Shows an impact dashboard in the WordPress admin: trees planted, CO2, your margin and your prepaid balance.
* An onboarding page under WooCommerce to store your API key and set the tree price.

= What works without a Click A Tree account =

You can install the plugin, set the tree price, and see the tree product and the cart and checkout widget
in your shop right away. No data is ever sent anywhere until you enter an API key. The external service is
only needed for the part it is responsible for: actually planting the trees, issuing certificates and
returning your impact statistics.

= Source code and build =

The block based cart and checkout widget is compiled into the "build" folder. The full human readable
source is shipped with the plugin in the "src" folder, together with the build configuration
("webpack.config.js" and "package.json"). The compiled files are generated with @wordpress/scripts. To
rebuild them from source, run "npm install" and then "npm run build" in the plugin folder. No code is
minified or obfuscated beyond this standard build step.

== External services ==

This plugin connects to the Click A Tree API at https://api.clickatree.com, a service operated by
Click A Tree. The connection is used for two things: to report purchased trees so they can be planted,
and to show your shop's impact statistics in the admin.

What data is sent, and when:

1. When an order that contains trees reaches a paid status (WooCommerce status "processing" or "completed"),
   the plugin sends: your shop URL, a one way hash of the order ID, the number of trees, the tree amount and
   the order currency. This is what tells Click A Tree to plant the trees for that order.
2. When you open the "Click A Tree Impact" page in the WordPress admin, the plugin sends your shop URL to
   retrieve your aggregated impact statistics (trees, CO2, margin, prepaid balance).

No personal data of your customers is transmitted. An order is identified only by a one way hash, never by
customer name, address or email. Nothing is sent until you enter your Click A Tree API key on the settings
page; entering the key and using the feature is what enables the data transfer.

This service is provided by Click A Tree. By using it you agree to their terms and privacy policy:

* Terms and conditions: https://clickatree.com/agb/
* Privacy policy: https://clickatree.com/datenschutz/

== Installation ==

1. Install and activate the plugin. WooCommerce must be installed and active.
2. Go to WooCommerce > Click A Tree.
3. Enter your Click A Tree API key and, if you want, change the price per tree.
4. That is it. The "add a tree" widget now appears in your cart and checkout, and paid orders with trees are
   reported to Click A Tree automatically.

You can follow your results any time under WooCommerce > Click A Tree Impact.

== Frequently Asked Questions ==

= Do I need a Click A Tree account? =

Yes, for the trees to actually be planted. You can install the plugin and set everything up without one, but
the planting, the certificates and the impact statistics run on the Click A Tree service, which needs a free
account and an API key.

= Who pays for the tree? =

The customer. They add the tree to their order and pay for it in your normal checkout. You keep a margin and
Click A Tree is paid for the planting out of your prepaid balance.

= Is any customer data sent to Click A Tree? =

No personal customer data. An order is identified only by a one way hash. See the "External services"
section for the exact list of what is sent and when.

= Does it work with the new cart and checkout blocks? =

Yes. The widget works with both the classic (shortcode) and the block based cart and checkout.

= In which languages is the plugin available? =

English and German. The plugin follows your WordPress language setting, so it switches automatically
when you change the site language under Settings, General, or your own language in your user profile.
Nothing needs to be configured in the plugin itself.

== Changelog ==

= 0.1.3 =
* Fixed: the German singular forms were missing, so a cart with exactly one tree still showed the English sentence.

= 0.1.2 =
* The plugin now speaks English by default and ships a German translation. WordPress picks the language from your site or user setting, so you can switch between them in the normal WordPress settings.
* Fixed: the cart and checkout block widget did not load translations at all, so it always stayed in the source language.

= 0.1.1 =
* Include the readable block source (src) and the build configuration in the plugin, and document the build in the readme.
* Removed the duplicate Plugin URI header.

= 0.1.0 =
* Initial release.
* Hidden, virtual tree product with a configurable price (one item = one tree).
* "Add a tree" widget for the classic and the block based cart and checkout.
* Reports paid orders containing trees to the Click A Tree service with an HMAC signed request.
* Impact dashboard in the WordPress admin (trees, CO2, margin, prepaid balance).
* Onboarding settings page (API key and tree price) under the WooCommerce menu.

== Upgrade Notice ==

= 0.1.0 =
Initial release.
