=== Orders and Stock Sync for Bind ERP ===
Contributors: catcodestudio
Tags: bind erp, erp, inventory, stock sync, mexico
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

Connect WooCommerce to your Bind ERP account in Mexico: pull the stock of a Bind warehouse into your products by SKU and send orders to Bind.

== Description ==

Bind ERP is a Mexican cloud ERP. This plugin connects your WooCommerce store to your own Bind account through the public Bind API, so the warehouse balance reaches the shop and a paid order reaches Bind as a sales order.

Bind ERP is a third-party product. This is an independent integration, not affiliated with or endorsed by Bind or Minnt Solutions.

= What it does =

* **Stock from Bind to WooCommerce**, by SKU, from the warehouse you choose. One call reads the whole catalogue. Products with no SKU, or with a SKU that Bind does not know, are never touched.
* **Orders from WooCommerce to Bind**: the "Bind ERP" box in the order has a "Send to Bind" button. The plugin finds the Bind client by e-mail or creates it from the billing data, then creates the sales order with the products, quantities and the unit price of the order.
* **No duplicates**: the Bind order id is kept on the order, and after a lost answer the plugin looks the order up in Bind by its reference before it sends anything again.
* **Clear reasons when an order does not go**: unknown SKU, no matching currency, a client without an address. Nothing is sent halfway.
* **Your RFC rules**: a buyer RFC from an order field of your choice is used when it looks like an RFC; otherwise the generic RFC you set (default XAXX010101000, the SAT generic RFC for sales to the public).

= Pro =

* Scheduled stock sync: hourly, twice a day or daily.
* Optional price sync: the WooCommerce regular price follows the Bind price list.
* Orders go to Bind automatically when they reach the status you choose, in the background, with a retry after a lost answer.
* Shipping goes to the order as a line with the sale concept you choose.
* 7-day trial. No card, and it never starts by itself.

= What you need =

A Bind account and an API key (your user profile in Bind, tab Integraciones, "Generar API Key"). Bind limits the public API per 5 minutes and per day; your plan's allowance is between you and Bind.

= What the plugin does not do =

* It does not issue invoices (CFDI) in Bind and does not register payments.
* It does not create products in Bind: products must exist there, with the same SKU as in WooCommerce.
* Discounts are sent as the lower unit price of the line; coupons are not sent as separate documents.
* It does not decide your taxes. The VAT of each product is the one Bind reports for it.

= External services =

This plugin connects to the **Bind ERP API** (api.bind.com.mx) with the API key you enter. It sends the order's lines, quantities and prices, and the buyer's billing data (name, e-mail, phone, address, RFC) to create the client and the sales order when you send an order, and it reads the catalogue, warehouses, price lists and currencies of your account. It sends nothing until you enter your key. Service: https://www.bind.com.mx/ . Terms: https://www.bind.com.mx/SistemaDeAdministracion/TerminosYCondiciones . Privacy: https://www.bind.com.mx/SistemaDeAdministracion/Privacidad .

The Pro build also talks to **catcode.com.ua**: licence key and site address, to activate the licence and check for updates. Terms: https://catcode.com.ua/terms/ .

== Installation ==

1. Install and activate the plugin (WooCommerce must be active).
2. Open WooCommerce → Bind ERP, paste the API key, save, and test the connection.
3. Choose the warehouse and the price list, and save again.
4. Make sure the SKUs in WooCommerce match the SKUs in Bind, then press "Pull the Bind stock into WooCommerce".
5. Open an order and press "Send to Bind" in the Bind ERP box.

== Frequently Asked Questions ==

= Where do I get the API key? =

In Bind: your user profile, tab Integraciones, "Generar API Key". The plugin stores it encrypted with the keys of your wp-config.php.

= Why was my order not sent? =

The Bind ERP box in the order says why. The usual reasons are an item whose SKU does not exist in Bind, or a currency that Bind does not have.

= Does it overwrite my stock? =

Only for products that have a SKU found in Bind, and only when you press the button (or, in Pro, on the schedule you set). Products that do not manage stock are skipped unless you allow the plugin to switch stock management on.

== Changelog ==

= 1.0.0 =
* First release.

== Upgrade Notice ==

= 1.0.0 =
First release.
