=== CatCode Zalando zDirect for WooCommerce ===
Contributors: catcodestudio
Tags: zalando, zdirect, marketplace, woocommerce, stock sync
Requires at least: 6.4
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

Sends WooCommerce stock levels and prices to Zalando through the zDirect API for approved Zalando partners.

== Description ==

Connects a WooCommerce shop to the Zalando [zDirect](https://developers.merchants.zalando.com/) API with your own app credentials. It is made for merchants who already are in the Zalando Partner Program and have an approved direct integration; it does not get you into the program.

* **Connection** — merchant ID, client ID and client secret from the zDirect Portal; sandbox and production environments. "Check connection" gets an access token and reads your sales channels. The secret is stored encrypted, and access tokens are reused until they expire.
* **Sales channels** — tick the Zalando countries you sell in.
* **Stock** — "Send stock now" sends the quantity of every product that has a valid EAN to every ticked channel, in batches. Zalando's answer is read per entry: accepted or rejected, with its reason.
* **Prices** — "Send prices now" sends the regular price of every product with a valid EAN to the channels whose currency is the shop currency (zDirect does not convert currencies, so other channels are skipped and named).
* **EAN** — taken from the GTIN / EAN field of the product or from a custom field you name; EANs are checked (digits and check digit) before anything is sent, and products without a valid EAN are listed.
* **Safety stock** and a **default quantity** for products that do not track stock.
* HPOS and block checkout compatible.
// @pro-begin
* Translations included: English, German.
// @pro-end

// @pro-begin
= Pro =

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

* **Stock follows the shop** — a stock change is sent to Zalando a few seconds later, once per product, and the whole list goes once a day.
* **Prices every day**, with the sale price as the promotional price.
* **Zalando orders in WooCommerce** — approved, not yet exported orders are fetched every 15 minutes and become WooCommerce orders with the customer's addresses and your products (matched by article number or EAN); each one is exported to Zalando with the order number as the merchant order ID, once.
* **Shipping and cancellation back to Zalando** — when the order is completed the tracking number is sent, then every line is reported as shipped; a cancelled order cancels its lines. The tracking number is entered in a box on the order screen.
* Updates from catcode.com.ua.

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. One key covers two sites: the shop and its test copy.
// @pro-end

Zalando and zDirect are trademarks of Zalando SE. This plugin is an independent integration made by CatCode; it is not an official plugin of Zalando and is not affiliated with or endorsed by it. Using the zDirect API requires your own approved Zalando partner account (for a direct integration Zalando asks for its approval).

== External services ==

The plugin connects to the Zalando zDirect API (Zalando SE, [developers.merchants.zalando.com](https://developers.merchants.zalando.com/)) at `api-sandbox.merchants.zalando.com` (sandbox) or `api.merchants.zalando.com` (production), the one you choose in the settings, and only after you enter your credentials.

* When you press "Check connection" and whenever a token is needed: the client ID and the client secret, to get an access token (`/auth/token`).
* When stock or prices are sent: your merchant ID, the EAN of each product, the sales channel, the quantity or the price and its currency.
// @pro-begin
* When orders are fetched, exported and shipped (Pro): the order ID, the merchant order ID (the number of the WooCommerce order), tracking numbers and the status of the order lines. The orders you receive contain the buyer's name, address and e-mail, which are stored in the WooCommerce order.
// @pro-end

[Zalando privacy information](https://www.zalando.de/zalando-datenschutz/)

== Installation ==

1. Upload the plugin and activate it. WooCommerce must be active.
2. In the zDirect Portal create an app, give it the scopes for sales channels, stocks and prices, and copy its client ID and secret; copy your merchant ID.
3. WooCommerce → **Zalando**: paste them, keep "Sandbox", press "Check connection", tick your sales channels and save.
4. Make sure your products have an EAN (the GTIN field in the Inventory tab), press "Check the catalogue", then "Send stock now".

== Frequently Asked Questions ==

= Can I use it without being a Zalando partner? =

No. The zDirect API is for partners; you create the app credentials in the zDirect Portal after Zalando has taken you on. For a direct integration Zalando asks for an assessment first.

= Does it create products at Zalando? =

No. Articles are onboarded in zDirect (or through your integrator). The plugin updates stock and prices of articles that exist there; an update for an EAN that is not in the catalogue yet waits until it is.

= Why were my prices skipped for a country? =

Zalando does not convert currencies and rejects a price in the wrong currency, so a channel only gets prices when its currency is the shop currency.

== Changelog ==

= 1.0.0 =
* First release.
