=== TSync Sheet for WooCommerce ===
Contributors: taalhaa, ABDUL_KARIM911
Tags: woocommerce, google sheets, order sync, spreadsheet, automation, dropshipping, export orders, google sheets sync
Requires at least: 6.0
Tested up to: 7.1.3
Requires PHP: 7.4
WC requires at least: 7.0
WC tested up to: 9.3
Stable tag: 1.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Automatically sync WooCommerce orders to Google Sheets in real time via webhook. Non-blocking asynchronous dispatch with zero monthly fees.

== Description ==

Managing WooCommerce orders often requires sharing live order data with fulfillment teams, delivery personnel, dropship suppliers, or accountants.

**TSync Sheet for WooCommerce** connects your WooCommerce store directly to your Google Spreadsheet via a fast, secure Webhook. Whenever a new order is placed, customer details, line items, and totals are automatically added as a new row in your Google Sheet in real time.

Ideal for dropshipping businesses, multi-vendor fulfillment, Cash on Delivery (COD) courier processing, and real-time sales accounting without paying expensive monthly Zapier or Make subscription fees.

### 🚀 Key Features

*   **Real-Time Order Synchronization:** New orders trigger an automated webhook that appends order data directly to your designated Google Sheet.
*   **Manual Re-Sync Action (New in 1.1.0):** Easily re-sync any order to Google Sheets directly from the WooCommerce Order Actions dropdown on the Edit Order screen with an automated audit note.
*   **Direct Settings Quick Link:** Added instant "Settings" shortcut on the WordPress Plugins screen.
*   **Zero Checkout Delay:** Uses asynchronous non-blocking background dispatch (`wp_remote_post` with non-blocking mode), ensuring customer checkout performance is never impacted.
*   **Built-in Connection Tester:** Test your webhook URL directly from the WordPress administration settings with the "Send Test Data" button before going live.
*   **Concurrency Safe:** The included Google Apps Script code utilizes Google's `LockService` to prevent data collisions during high-traffic sales.
*   **HPOS Compatible:** Fully compatible with WooCommerce High-Performance Order Storage (Custom Order Tables).
*   **Order Deduplication:** Includes built-in metadata safeguards to ensure that individual orders are synchronized without duplication.
*   **Zero Monthly Fees:** Direct connection between your WordPress server and your own Google Apps Script Web App. No third-party middleware required.

### 💡 Direct & Self-Hosted Integration

TSync Sheet communicates directly between your WordPress server and your own Google Apps Script Web App. This eliminates intermediate third-party service dependencies, keeping your order data private and under your control.

== Installation ==

Setting up TSync Sheet takes only a few minutes:

### Step 1: Install the Plugin
1. Go to your WordPress Dashboard.
2. Navigate to **Plugins > Add New Plugin**.
3. Search for **TSync Sheet for WooCommerce** or click **Upload Plugin** and select `tsync-sheet.zip`.
4. Click **Install Now** and then **Activate**.

### Step 2: Set up your Google Sheet
1. Open a new Google Sheet.
2. Click **Extensions > Apps Script** in the top menu.
3. Paste the provided script code from the plugin guide into the script editor.
4. Click **Deploy > New deployment**, select **Web app**, set access to **Anyone**, and click **Deploy**.
5. Copy the generated Web app URL.

### Step 3: Connect WooCommerce
1. In your WordPress admin, go to **WooCommerce > TSync Sheet**.
2. Paste your Web app URL into the field and click **Save Settings**.
3. Click **Send Test Data** to verify your setup.

== Frequently Asked Questions ==

= Can I manually re-sync an individual order? =
Yes! From any single WooCommerce order edit screen, locate the **Order Actions** box on the right, select **Resync to Google Sheet (TSync Sheet)** from the dropdown, and click the update button. The order will be immediately sent to your Google Sheet and a confirmation note will be added to the order history.

= Does it support WooCommerce High-Performance Order Storage (HPOS)? =
Yes! TSync Sheet is 100% compatible with HPOS (Custom Order Tables).

= Will it slow down my website's checkout page? =
No. The plugin uses asynchronous non-blocking HTTP requests. WooCommerce creates the order and finishes checkout without waiting for Google's HTTP response.

= Which order fields are synced to Google Sheets? =
The plugin synchronizes: Order ID, Order Number, Date, Status, Currency, Totals, Subtotals, Shipping Cost, Payment Method, Customer Name, Email, Phone, Shipping Address, Item Details (Product Name, SKU, Quantity, Price), and Customer Notes.

= Can I use this with Cash on Delivery (COD) express checkout? =
Yes! It pairs seamlessly with our companion plugin **Taalhaa Express Checkout for WooCommerce**, which adds a fast 1-click modal checkout for COD orders.

= How do I recover lost or abandoned carts? =
You can use our companion cart recovery plugin **TRecover – Cart Recovery for WooCommerce** to automatically capture checkout emails and send recovery reminders.

== Screenshots ==

1. The clean settings page under WooCommerce.
2. The Send Test Data feature verifying webhook connectivity.
3. Live order data appearing structured in Google Sheets.

== Changelog ==

= 1.1.0 =
* Feature: Added manual "Resync to Google Sheet" option in WooCommerce Order Actions dropdown on single order edit screens.
* Feature: Added order history audit note upon successful manual re-sync.
* Feature: Added direct "Settings" quick link on WordPress Plugins management page.
* Enhancement: Updated compatibility for WordPress 7.1.3 and WooCommerce 9.3.
* Enhancement: Expanded GNU POT translation template with new action strings.

= 1.0.0 =
* Initial release.
* Automated order synchronization on order creation.
* Settings screen with instant Webhook test dispatch.
* Concurrency-safe Google Apps Script template.
* Full WooCommerce HPOS compatibility.

