=== Printags for WooCommerce ===
Contributors: printags
Tags: woocommerce, nfc, print on demand, business cards, custom cards
Requires at least: 6.4
Tested up to: 7.1
Requires PHP: 7.4
WC requires at least: 8.0
WC tested up to: 11.3
Stable tag: 1.0.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Sell custom printed NFC cards: customers upload their artwork, Printags prints and ships paid orders, tracking comes back automatically.

== Description ==

Printags prints and encodes PVC, NFC and wood cards. This plugin connects your WooCommerce shop to your Printags account, so you can sell customised cards without handling production yourself.

* **Connect in one click**: WooCommerce > Settings > Printags > "Connect Printags" (OAuth, no API key to copy). Starts in Test (sandbox) mode; switch to Production when you go live.
* **Customisable products**: in the "Printags" product tab, tick "Customisable Printags card" and pick the Printags product (and an optional packaging).
* **Artwork upload on the product page**: PNG, JPEG or PDF up to 25 MB, sent straight from the customer's browser to Printags. Preview and proportion check (89.6 × 57.98 mm). Optional link to encode in the NFC chip (it cannot be changed after ordering). Locking the chip read-only is an opt-in per product (irreversible).
* **Automatic orders**: when an order is paid, the plugin checks the price and your Printags balance, then creates the Printags order. Never twice (idempotency key), retried automatically on network errors. If your balance is too low, the order is put on hold and you get an e-mail; top up, then use the order action "Send to Printags".
* **Tracking**: Printags status and tracking number are shown on the order and added to the "Completed order" e-mail, in real time (webhook) or every 6 hours (fallback).

Compatible with High-Performance Order Storage (HPOS) and with the Cart and Checkout blocks. Source strings in English, French translation included.

A Printags account is required. Cards are paid from your Printags balance at Printags prices; the plugin itself is free.

== Installation ==

1. Install and activate WooCommerce, then this plugin.
2. WooCommerce > Settings > Printags: the plugin starts in Test mode (sandbox, nothing charged). Choose Production when you go live, save, click "Connect Printags" and approve on Printags. Your site admin must be served over https.
3. Edit a product, open the "Printags" tab, tick "Customisable Printags card" and choose the Printags product.

== Frequently Asked Questions ==

= Do I need a Printags account? =

Yes. "Connect Printags" lets you sign in or create an account, then approve the connection. Test mode uses the Printags sandbox and its own connection.

= Where does the customer's file go? =

Directly from the browser to the Printags API through a single-use signed link. Your server never stores it and the browser never sees your Printags credentials.

= What happens in Test mode? =

Orders are created on the Printags sandbox: neither charged nor manufactured. Test and production each have their own connection.

= When is an order sent to Printags? =

When it is paid (status "Processing" or "Completed"). Payment-on-delivery orders wait until they are paid, unless you enable "Send payment-on-delivery orders automatically". A cancelled or refunded order is never cancelled at Printags automatically: you get a note and an e-mail.

= Does it work with the Cart and Checkout blocks? =

Yes. The customer uploads the visual on the product page; the cart and checkout (blocks or classic) show the file name and NFC link, and keep them on the order.

= What happens on a staging copy of my shop? =

Nothing is sent from it. The connection is bound to the site address it was made on; a copy needs its own connection.

== Screenshots ==

1. WooCommerce > Settings > Printags: connected account, balance, mode and options.
2. Product editor, "Printags" tab: the Printags product, chip lock opt-in and packaging.
3. Product page: the customer uploads the card visual, with preview and proportion check, and the optional NFC link.
4. Cart block: the uploaded visual and the NFC link are shown on the line.
5. Order screen: the Printags box with the Printags order, its status and the tracking number.

== External services ==

This plugin connects to the Printags API, operated by PRINTAGS SAS (France), to print, encode and ship the cards you sell. It talks to https://api.printags.com, or to https://sandbox-api.printags.com in Test mode. Nothing is sent before you click "Connect Printags".

* **When you connect**: the shop name and its callback address are sent to register the shop (OAuth), then you sign in and approve on Printags. A webhook address of your site is registered for tracking updates.
* **In the admin**: your account name, balance and the Printags product catalogue are read to fill the settings and the product tab.
* **On the product page**: when a customer chooses a file, your site asks Printags for a single-use upload link (file name, type and size), then the customer's browser uploads the artwork file directly to Printags.
* **When an order is paid**: the order lines (Printags product, quantity, uploaded file id, NFC link, packaging), the shipping address (name, company, address, phone, e-mail) and the carrier service are sent to quote and create the Printags order.
* **Tracking**: Printags calls your site back (webhook) with the order status and tracking numbers; the plugin also reads the status of open orders every 6 hours.
* **Tokens and disconnection**: the access token is refreshed with Printags before it expires; "Disconnect" deletes the webhook and revokes the authorization at Printags.

Printags terms of sale: https://www.printags.com/en/terms-and-conditions/ (French: https://www.printags.com/fr_fr/cgv/)
Printags privacy policy: https://www.printags.com/en/privacy-policy/ (French: https://www.printags.com/fr_fr/politique-de-confidentialite/)

The plugin does not track visitors and sends no usage statistics.

== Privacy ==

The customer's shipping address and contact details are sent to Printags only for paid orders containing Printags cards, to manufacture and ship them. Mention Printags as a recipient of this data in your shop's privacy policy. Uninstalling the plugin deletes its settings and stored credentials; order data that documents orders already sent is kept.

== Development ==

The plugin ships its PHP, JavaScript and CSS source as is: no build step, no minified file. Unit tests, coding standards and the end-to-end suite are run with Docker (see README.md in the source repository).

== Changelog ==

= 1.0.1 =
* A new installation starts in Test mode; Production shows a warning before connecting. A shop connected in Production keeps it.
* After a lost answer, the order is looked up at Printags by its key before anything else: a paid order is no longer put on hold for "insufficient balance" when it was already created.
* The creation attempt is recorded before the request leaves; one attempt at a time per order.
* An order keeps the mode it was queued in until "Send to Printags" is used.
* Accented file names and order numbers are cut on characters.

= 1.0.0 =
* First version: OAuth connection (production and test), artwork upload on the product page, paid orders sent to Printags with quote and balance check, tracking by webhook and polling, HPOS and Cart/Checkout blocks support, French translation.

== Upgrade Notice ==

= 1.0.1 =
Fixes an order already created at Printags being put on hold after a lost answer, and the mode of queued orders. New installations start in Test mode.

= 1.0.0 =
First version.
