=== eMAG Marketplace Connector for WooCommerce ===
Contributors: catcodestudio
Tags: emag, marketplace, romania, bulgaria, hungary
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

Sell your WooCommerce products on eMAG Marketplace (Romania, Bulgaria, Hungary): link your offers and keep prices and stock in sync.

== Description ==

You sell in your own WooCommerce shop and on eMAG. Every price change and every sale has to be repeated in the eMAG seller account — or an offer oversells. This plugin connects the two through the official eMAG Marketplace API.

= Free =

* Connection to eMAG Romania, eMAG Bulgaria, eMAG Hungary and Fashion Days (Romania, Bulgaria) — the same Marketplace API.
* Import of your existing eMAG offers, linked to WooCommerce products by SKU (eMAG part number), EAN or id. A report shows the offers without a product.
* Price and stock sync of the linked offers, automatically a few minutes after a change (a sale, an edit, an import) and on demand. Only changed data is sent, in batches of up to 50 offers.
* Price rules: WooCommerce price with or without VAT (eMAG takes the price without VAT), markup in % and a fixed add-on, a conversion rate for another shop currency, the regular price as the recommended (crossed-out) price during a sale, the min–max price range that eMAG enforces.
* VAT: the eMAG VAT rates are read from your account; each WooCommerce tax class gets its eMAG rate, and a product can override it.
* Stock reserve kept for your own shop, a quantity for products without stock management, handling time per shop and per product.
* A product that is unpublished, deleted or switched off goes inactive on eMAG.
* eMAG status of every offer: documentation validation, documentation errors, eMAG price and stock.
* API log for 30 days (as eMAG recommends); the password is stored encrypted and never logged.

= Pro =

* eMAG orders in WooCommerce — instantly through the eMAG callback URLs, with a check every 5 minutes as a safety net. Buyer, delivery address or pickup point (locker), products, VAT, vouchers, recycling deposits and shipping. The order is acknowledged on eMAG and the stock goes down.
* Cancellations on eMAG cancel the WooCommerce order and restore the stock.
* Order status back to eMAG: prepared, finalized or cancelled with a reason.
* AWBs through your eMAG courier accounts from the order screen, PDF labels (A4/A5/A6), hourly status updates, optional completion on delivery.
* Invoices sent to the eMAG order.
* Publishing: attach an offer to an existing eMAG product found by EAN, or create a new product with category, brand, description, images, characteristics (automatically from product attributes, or mapped per category), EAN, warranty and variation families.
* Buy button monitor: your rank, the number of offers and the best price, with an e-mail when you lose first place.

Pro can be tried for 7 days for free, no card needed.

= Languages =

English, Romanian (ro_RO), Bulgarian (bg_BG), Hungarian (hu_HU).

= Requirements =

* An eMAG Marketplace seller account with an API user (API rights are granted in the account).
* eMAG only accepts API calls from whitelisted IP addresses: add the outgoing IP address of your server in the eMAG seller account.
* WooCommerce 7.0 or newer; HPOS and the classic orders storage are both supported.

eMAG is a trademark of its owner. This is an independent integration, not affiliated with or endorsed by eMAG.

== Installation ==

1. Upload the plugin and activate it.
2. WooCommerce → eMAG Marketplace → Connection: choose the marketplace, enter the API user and password, save and press "Check the connection". The VAT rates load from eMAG.
3. Offers: check the price rules and press "Import and link offers". Linked products keep their eMAG price and stock in sync from now on; "Resend all linked products" pushes everything at once.
4. Pro — Orders: switch on the import and paste the two callback URLs into your eMAG seller account. Shipping: read your courier accounts and addresses, enter the sender phone.

== Frequently Asked Questions ==

= Does the plugin create offers on eMAG? =

The free version keeps existing offers in sync (eMAG's light API only updates offers that exist). New offers are created in the eMAG seller account or, with Pro, published from the product editor.

= Is there an eMAG test account? =

eMAG does not offer a public sandbox. The plugin is built on the official eMAG Marketplace API reference (v4.5.2) and tested against a simulation of it; the log shows every call and eMAG's answer, so a refusal is always visible with eMAG's own text.

= The check fails with HTTP 403 =

eMAG answers only whitelisted IP addresses. Add the outgoing IP of your server in the eMAG seller account (your host can tell you which one it is).

= Why do eMAG orders have no e-mail address? =

eMAG sends a hash instead of the buyer's e-mail. The order is imported without it, so WooCommerce sends no e-mails to the buyer; eMAG informs the buyer itself.

== External services ==

This plugin connects to the eMAG Marketplace API of the marketplace you choose (marketplace-api.emag.ro, marketplace-api.emag.bg, marketplace-api.emag.hu, marketplace-ro-api.fashiondays.com or marketplace-bg-api.fashiondays.com), with the API user and password you enter. It sends offer data (offer id, prices without VAT, stock, handling time, VAT id, status) when products change or when you press a sync button, reads your offers, categories, VAT rates, orders, courier accounts and addresses, and — with Pro — sends order status changes, AWB requests (sender and receiver name, phone and address as in the eMAG order), invoice links and product documentation (name, description, brand, images, characteristics, EAN). eMAG Marketplace information centre: https://marketplace.emag.ro/infocenter/ ; eMAG Marketplace privacy policy: https://marketplace.emag.ro/infocenter/privacy-policy/?lang=en

The Pro build also contacts the CatCode licence server (catcode.com.ua) to activate and verify a licence key or to start a trial: it sends the key, the site address and, for a trial, the e-mail you enter. Terms and privacy: https://catcode.com.ua/

== Changelog ==

= 1.0.0 =
* First release: offer import and linking, price and stock sync, VAT rules, API log. Pro: orders with callbacks and polling, status back to eMAG, AWBs and labels, invoices, publishing, Buy button monitor.
