=== Connector for Mirakl Marketplaces ===
Contributors: catcodestudio
Tags: mirakl, marketplace, worten, carrefour, 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

Sells WooCommerce products on Mirakl marketplaces (Worten, PcComponentes, Carrefour, Leroy Merlin…) with price and stock from the shop.

== Description ==

Many European marketplaces run on the Mirakl platform: Worten, PcComponentes, Carrefour, Leroy Merlin, Decathlon and others. Each of them gives its sellers the same Mirakl Seller API. This plugin connects a WooCommerce shop to that API with the API key of your own seller shop and keeps your offers on the marketplace in line with the shop.

* **Connection** — the Mirakl address of the marketplace and the API key of your shop (the marketplace gives both to its sellers). "Check connection" reads your shop, its currency, the offer conditions (new, used…) of the marketplace and, once a day, the carriers. The key is stored encrypted.
* **Offers from your products** — tick "Sell on Mirakl marketplaces" in the new "Mirakl" tab of a product. The marketplace finds the product in its catalogue by its EAN (or by another reference type the marketplace uses), so each product or variation needs one: the GTIN / EAN field of WooCommerce, a field of the plugin, or a custom field you name.
* **Existing offers** — "Link offers already on the marketplaces" reads the offers of your shop and links them to your products by shop SKU or EAN. What the plugin does not manage (description, logistic class, order quantity limits, custom fields) is kept and sent back unchanged.
* **Prices** — the gross shop price plus a markup in percent and a fixed amount per marketplace, or a marketplace price of its own per product. A marketplace in another currency gets the price converted at the rate you set; without a rate it gets no price instead of a wrong one. Optionally a WooCommerce sale is sent as a marketplace discount with its dates.
* **Stock** — the stock of the product minus a safety reserve, a default quantity for products without stock management, and 0 for products that are switched off, out of stock, unpublished or in the trash.
* **Per offer** — condition, lead time to ship and logistic class, per marketplace or per product.
* **Automatic** — a change of a product goes into a queue that is sent every 5 minutes, and only what changed is sent. Mirakl takes offers at most once a minute per shop and checks them in the background; the plugin reads the result of each import and shows, per product, whether the offer was accepted or why it was refused.
* **Results** — the result per marketplace in the product, the last runs on the settings screen and an API log of the last 300 requests (without the key or buyer data).
* HPOS compatible.


Mirakl, Worten, PcComponentes, Carrefour, Leroy Merlin and the other names are trademarks of their owners. This plugin is an independent integration made by CatCode; it is not an official plugin of Mirakl or of any marketplace and is not affiliated with or endorsed by them. You need your own seller shop on the marketplace.

== External services ==

The plugin connects only to the Mirakl addresses of the marketplaces you enter (for example `https://<name>.mirakl.net`), and only after you enter the API key of your shop.

* When you press "Check connection": the API key, to read your shop (name, ID, currency, state), the offer conditions, the carriers and the order document types of the marketplace.
* When offers are linked or sent: your shop SKU, the product reference (EAN), the condition, the price (and discount), the quantity, the lead time to ship and the logistic class of each product you switched on, plus the offer fields read when the offer was linked.

Each marketplace has its own seller terms and privacy policy: you accepted them when you opened your shop there. Mirakl: [terms](https://www.mirakl.com/terms-of-service/) · [privacy policy](https://www.mirakl.com/privacy-policy/)

== Installation ==

1. Install and activate the plugin (WooCommerce must be active).
2. Open WooCommerce → Mirakl, enter the Mirakl address of the marketplace and the API key of your shop, press "Check connection" and save.
3. Choose the offer condition and, if the marketplace uses another currency, the exchange rate. Save.
4. In each product you want to sell, open the "Mirakl" tab and tick "Sell on Mirakl marketplaces" (or press "Link offers already on the marketplaces" if your offers are there already).
5. Press "Send changes now", or wait for the next run (every 5 minutes). The result shows up in the product a few minutes later.

== Frequently Asked Questions ==

= Which marketplaces work? =

Every marketplace that runs on Mirakl and gives its sellers access to the Mirakl Seller API, for example Worten, PcComponentes, Carrefour, Leroy Merlin or Decathlon. Some marketplaces use their own address instead of `*.mirakl.net`; the address is in their seller documentation.

= Where do I find the API key? =

The marketplace gives it to its sellers: look in its seller back office or its API documentation for sellers, or ask its seller support.

= The product is not on the marketplace yet. Will the plugin create it? =

No. A Mirakl offer is attached to a product of the marketplace catalogue, found by its EAN. If the marketplace does not know the EAN, the offer is refused with a message saying so; new products are added through the catalogue import of the marketplace.

= Why does the result take a few minutes? =

Mirakl takes offers at most once a minute and checks them in the background. The plugin reads the result on its next runs and shows it in the product.

= Does the plugin overwrite my offer description? =

No. Fields the plugin does not manage are read when you link your existing offers and are sent back unchanged.

= Does it work with variable products? =

Yes. Every variation is an offer of its own and needs its own EAN.

== Changelog ==

= 1.0.0 =
* First release: Mirakl Seller API connection by API key and address; offers from products and variations by EAN (or another reference type), linking of existing offers by shop SKU or EAN with their own fields kept; price with markup, exchange rate, own price and optional sale discount; stock with safety reserve; condition, lead time and logistic class; queue every 5 minutes with the import results per product; API log.
