=== Mercado Libre Connector for WooCommerce ===
Contributors: catcodestudio
Tags: mercado libre, mercado livre, marketplace, stock sync, woocommerce
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

Lists WooCommerce products on Mercado Libre (Brazil, Mexico, Argentina, Colombia) and keeps their prices and stock in sync.

== Description ==

Connects a WooCommerce shop to the [Mercado Libre API](https://developers.mercadolibre.com.ar/) through an application of your own and your seller account. Works with Mercado Livre Brazil, Mercado Libre Mexico, Argentina and Colombia.

* **Connection** — OAuth 2.0: create an application in the Mercado Libre developer centre with the redirect URI the plugin shows, save its APP ID and secret key, press "Connect to Mercado Libre" and allow the application. The access token is renewed by itself; the secret key and the tokens are stored encrypted. If the access is revoked or the password changes, the plugin says so on every admin screen and asks to connect again.
* **Listings from your products** — tick "Sell on Mercado Libre" in the new "Mercado Libre" tab of a product. Category ID (with a suggestion from the product name and a check of the attributes the category requires), listing type, condition, brand, model, GTIN, other attributes, your own Mercado Libre price. Shop categories can carry a Mercado Libre category for all their products.
* **Both listing models** — sellers in the User Products model (price per variation) get one listing per variation, grouped by a family name; sellers still in the previous model get one listing with its variations. The plugin reads which model your account uses.
* **Existing listings** — "Link items already on Mercado Libre" reads the items of your account and links them to your products by SELLER_SKU (your SKU) or GTIN, so nothing is listed twice.
* **Prices** — the shop price with tax (the sale price while a sale runs) plus a markup in percent and a fixed amount, or a price of its own per product. If the shop uses another currency than the Mercado Libre site, the price is converted at the rate you set; without a rate no price is sent instead of a wrong one.
* **Stock** — the stock of the product minus a safety reserve, a default quantity for products without stock management, and 0 for products that are out of stock (Mercado Libre pauses the listing and reactivates it when stock comes back). A product switched off, unpublished or in the trash is paused.
* **Automatic** — a change of a product goes into a queue that is sent every 5 minutes, and only what changed is sent. "Send changes now" and "Send all again" do it at once.
* **Results** — the result per listing in the product (with a link to the listing), the last runs on the settings screen and an API log of the last 300 requests (without tokens or buyer data).
* HPOS compatible.


Mercado Libre and Mercado Livre are trademarks of their owner. This plugin is an independent integration made by CatCode; it is not an official Mercado Libre plugin and is not affiliated with or endorsed by Mercado Libre. You need your own Mercado Libre seller account and application.

== External services ==

The plugin connects to Mercado Libre only after you save the credentials of your own application and connect your account.

* The authorization page of your country (`https://auth.mercadolivre.com.br`, `https://auth.mercadolibre.com.mx`, `https://auth.mercadolibre.com.ar` or `https://auth.mercadolibre.com.co`): when you press "Connect", your browser goes there with the APP ID, the redirect URI and a random state.
* The Mercado Libre API (`https://api.mercadolibre.com`): the APP ID, the secret key and the authorization code or refresh token to get an access token; then, with that token, the account data (`/users/me`), category suggestions and attributes for the product names you ask about, and for each product you switch on its title or family name, category, price, quantity, condition, listing type, picture URLs, description, brand, model, GTIN, SKU and the other attributes you enter.

[Mercado Libre terms and conditions](https://www.mercadolibre.com.ar/ayuda/terminos-y-condiciones-de-uso_991) · [Mercado Libre privacy](https://www.mercadolibre.com.ar/privacidad) · [Developer terms](https://developers.mercadolibre.com.ar/en_us/api-docs)

== Installation ==

1. Upload the plugin and activate it. WooCommerce must be active.
2. WooCommerce → **Mercado Libre**: choose your country and copy the redirect URI.
3. In the Mercado Libre developer centre of your country, log in with the seller account, create an application in "My applications" with that redirect URI and the scopes read, write and offline_access. Copy its APP ID and secret key into the plugin and save.
4. Press "Connect to Mercado Libre" and allow the application with the main account of the seller (not a collaborator).
5. If you already sell on Mercado Libre, press "Link items already on Mercado Libre".
6. Open a product, tick "Sell on Mercado Libre" in its "Mercado Libre" tab, set the category (or press "Suggest from the name"), check the required attributes and save. Press "Check the catalogue", then "Send changes now".

== Frequently Asked Questions ==

= Why my own application? =

Mercado Libre gives API access to applications; with your own one the access belongs to your account only, and nothing passes through a third party.

= The site must be on HTTPS? =

Yes. Mercado Libre redirects back and sends notifications only to HTTPS addresses.

= Why is a product skipped? =

It has no Mercado Libre category, no price (or no exchange rate when the shop currency differs), no picture, or it is out of stock. The reason is shown in the "Mercado Libre" tab of the product. Mercado Libre's own refusals (missing required attribute, title too long…) are shown there too, with its text.

= Does it change the title or the pictures of a listing later? =

No. Titles, pictures and attributes are sent when the listing is created; after that the plugin keeps the price, the quantity and the paused / active state in sync. "Send all again" also replaces the description.

= Are variations supported? =

Yes, in both models. In the previous model Mercado Libre takes one price for all variations of a listing, so the highest price of the variations is sent.

== Changelog ==

= 1.0.0 =
* First release.
