=== CatCode Daraz Connector for WooCommerce ===
Contributors: catcodestudio
Tags: daraz, marketplace, woocommerce, inventory, bangladesh
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 Daraz through the Daraz Open Platform: link products by SKU and keep stock and prices in sync.

== Description ==

Sellers who run their own WooCommerce shop and a Daraz store end up retyping stock and prices in two places. This plugin talks to the **Daraz Open Platform** directly, with your own application, and keeps the two in step:

* **Your own application:** you register an application (category "Seller In-house APP") on the Daraz Open Platform of your country, enter its App Key and App Secret, and authorise the shop with one click through Daraz's standard OAuth sign-in. No middleman service sits in between.
* **Link by SKU:** the WooCommerce SKU is the seller SKU of the Daraz listing; one button finds the Daraz item and SKU ids for all your products and variations.
* **Stock and price sync:** a change of stock or price in WooCommerce goes to Daraz within a minute, in batches the platform allows. Per-product opt-out, a safety margin of units kept back, a percentage adjustment of the price (for example for Daraz's commission), rounding to whole numbers.
* **Five Daraz countries:** Bangladesh, Pakistan, Sri Lanka, Nepal and Myanmar, each with its own endpoint and application.
* **Tokens kept safe:** the App Secret and the access tokens are stored encrypted, and the access token is renewed before it ends.
* **API log:** every call to Daraz with the answer and the timing, kept 30 days.
* HPOS (custom order tables) supported.
// @pro-begin
* English and Bangla interface.
// @pro-end
// @pro-begin

= Pro =

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

* **Daraz orders in WooCommerce** — orders are imported every ten minutes as WooCommerce orders with items, address, phone and payment method; a cancellation on Daraz cancels the order here and the stock goes back.
* **Packing from the order screen** — pack on Daraz, mark ready to ship, see the tracking number and open the shipping label.
* **Publish a product to Daraz** — a new listing from a WooCommerce product, with images, package size and the category's attributes.

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.
// @pro-end

= Before you start =

Daraz decides who may use its API. You need a developer account and an approved application on the Daraz Open Platform, with the product API permissions. The plugin cannot skip these steps. Daraz is a trademark of its owner; this plugin is not made or endorsed by Daraz.

== External services ==

This plugin sends data to the Daraz Open Platform, the API of the Daraz marketplace, to the address of the country you choose in the settings: api.daraz.com.bd (Bangladesh), api.daraz.pk (Pakistan), api.daraz.lk (Sri Lanka), api.daraz.com.np (Nepal) or api.shop.com.mm (Myanmar). It sends your App Key, a request signature made with your App Secret, your access token, and the data of the call: SKUs, stock and prices of your products. The connection screen opens the Daraz sign-in page of the same host in your browser. Terms: https://open.daraz.com/doc/doc.htm#/?docId=507 and the data protection policy on the same site.
// @pro-begin

The Pro build also contacts catcode.com.ua to check the licence key (the key, the site address and the plugin version are sent) and to look for new versions.
// @pro-end

== Installation ==

1. Install and activate the plugin. WooCommerce must be active.
2. WooCommerce → Daraz: follow the four steps on the screen — create the application on the Daraz Open Platform, set the callback URL it shows, enter the App Key and App Secret, press "Connect to Daraz".
3. Press "Link products by SKU", then "Send everything now".

== Frequently Asked Questions ==

= How are products matched? =

By SKU. The SKU of a WooCommerce product (or variation) must be exactly the seller SKU of the Daraz listing.

= Which price is sent? =

The price the buyer pays in the shop (the sale price while a sale runs), with the percentage and rounding from the settings.

= Does the stock go both ways? =

The shop is the source: stock and price are sent from WooCommerce to Daraz.

= The warehouse code? =

Daraz takes stock per warehouse. "Load warehouses" lists the codes your account has; enter one in the settings.

== Changelog ==

= 1.0.0 =
* First release: OAuth connection to the Daraz Open Platform of five countries, linking by SKU, stock and price sync, API log, Bangla translation.
