=== Lob Direct Mail for WooCommerce ===
Contributors: catcodestudio
Tags: postcard, direct mail, lob, address verification, woocommerce
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

Send a printed postcard to a WooCommerce customer from the order screen through the Lob print and mail API, and check US delivery addresses against USPS data.

== Description ==

Lob prints and mails physical postcards and letters through an API. This plugin connects your WooCommerce store to your own Lob account:

* **Postcard from the order screen** — one button on the order sends a postcard to the delivery address of the order. Front and back are HTML you edit in the settings, with merge variables for the customer's first name, order number, order total and shop name.
* **Test mode first** — with a Lob test key the postcard is created and you can open its preview, but nothing is printed or mailed and nothing is billed. Switch to the live key when you are happy.
* **US address check** — one click checks the delivery address of an order against USPS data through Lob and tells you if it is deliverable, needs an apartment number, or is undeliverable.
* **Order notes** — every piece created is written to the order with its Lob id, mode and expected delivery date. A second postcard for the same order is never sent by accident: a repeat click is a deliberate "send another".
* HPOS (custom order tables) supported. US delivery addresses only; the return address must be in the US as well (Lob requirement).
// @pro-begin
* Spanish (United States) translation included.
// @pro-end

// @pro-begin
= Pro =

The Pro version is sold on [catcode.com.ua](https://catcode.com.ua/modules/lob-direct-mail-woocommerce/), with a 7-day trial that never starts by itself:

* **Automatic postcards** when an order reaches the status you choose, one per order, with a minimum order total and a daily cap.
* **Letters** from an HTML template with the same merge variables.
* **Address check at checkout** — an undeliverable US address is caught before the customer pays (classic checkout; with the Checkout block the verdict is added as an order note). If Lob cannot be reached the order is never blocked.
* **Bulk action** on the orders list.

The licence runs for 1-5 years and includes updates and support for that term; a purchased licence keeps its Pro features after the term ends.
// @pro-end

= Lob account and costs =

You need your own Lob account (free to open, with test keys). Live postcards and letters, and live address checks beyond the free allowance of your Lob plan, are billed by Lob according to your Lob plan. This plugin is not made or endorsed by Lob.

= External service =

The plugin sends data to the Lob API (api.lob.com) when you press a button, when an automatic send runs, or when the checkout address check is on: the recipient name and delivery address, your return address, the postcard or letter template, and the order number. Nothing is sent until you enter a Lob API key. See Lob's [terms](https://www.lob.com/legal/terms) and [privacy policy](https://www.lob.com/legal/privacy).

== Installation ==

1. Install and activate the plugin. WooCommerce must be active.
2. WooCommerce → Lob Direct Mail: paste your Lob test secret key, enter the return address, check the postcard text, save.
3. Open an order, press "Send postcard", then open the preview link in the box. When it looks right, add the live key, switch the mode to Live and send real mail.

== Frequently Asked Questions ==

= Does it print anything in test mode? =

No. Lob creates the mail piece and a preview, but nothing is printed, mailed or billed.

= Can I send to addresses outside the US? =

Not in this version: the plugin refuses non-US delivery addresses with a clear message.

= Where do I get the keys? =

In the Lob dashboard, Settings → API Keys. Test keys start with test_ and live keys with live_; the plugin refuses a key of the wrong kind for the selected mode.

== Changelog ==

= 1.0.0 =
* First release.
