=== World Inspire Product Feed for Google Shopping ===
Contributors: hxsmyxh
Tags: google shopping, merchant center, product feed, surecart, trustmate
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Real-time, high-performance product feed generator for Google Shopping and Trustmate reviews sync with SureCart & WooCommerce.

== Description ==

**World Inspire Product Feed for Google Shopping and Trustmate** generates real-time, compliant XML feeds for Google Merchant Center (Google Shopping, Free Product Listings) and Trustmate customer review sync.

Engineered with an **Anti-Cache Streaming Architecture**, this plugin completely bypasses reverse-proxy static disk cache traps (Varnish, SiteGround, Cloudflare, Hostinger), delivering fresh, accurate inventory, pricing, and multi-country shipping data directly from your WordPress database.

### 🌟 Key Features

* **Multi-Engine eCommerce Compatibility**: Native auto-detection and data extraction for both **SureCart** (`sc_product`) and **WooCommerce** (`product`). Zero fatal errors if either or neither is active.
* **Google Merchant Center Specification**: Built according to official Google RSS 2.0 standards with all essential namespace attributes: `<g:id>`, `<g:title>`, `<g:description>`, `<g:link>`, `<g:image_link>`, `<g:availability>`, `<g:price>`, `<g:brand>`, `<g:condition>`, `<g:identifier_exists>`, `<g:google_product_category>`, `<g:color>`, `<g:age_group>`, and `<g:gender>`.
* **Custom Labels 0–4 for Google Ads / PMax**: Full support for `<g:custom_label_0>` through `<g:custom_label_4>` with rules for price tiers (< $25, $25-$50, $50-$100, $100+), inventory status, category mapping, clearance/promotion tag keywords, and custom post meta fields.
* **Variant Grouping (`<g:item_group_id>`)**: Automatically expands WooCommerce variable products (`product_variation`) into individual variant items linked by parent `<g:item_group_id>`, enabling swatch selection in Google Shopping results.
* **Variant Attribute Optimization**: Smart extraction for `<g:size>`, `<g:material>` (Gold, Silver, Leather, Cotton, Gemstones, etc.), and `<g:pattern>` (Solid, Striped, Floral, Beaded) directly from attributes or intelligent NLP heuristics.
* **Multi-Country Shipping Generator**: Automatically embeds multi-destination `<g:shipping>` nodes (defaulting to 8 core global markets: US, CA, UK, JP, SG, HK, AE, MX with custom shipping service names and rates).
* **Live Diagnostics & Product Inspector Simulator**: Test and audit any product ID directly in WordPress Admin to verify extracted attributes, custom labels matching reasons, and preview raw `<item>` XML snippets.
* **Automatic Pet Category Mapping**: Heuristically detects pet collars, harnesses, and animal accessories and maps them to `Animals & Pet Supplies > Pet Supplies > Pet Collars & Harnesses`.
* **Trustmate Review Catalog Sync**: Dedicated `<products>` XML feed format ready for instant connection in your Trustmate merchant dashboard.
* **Anti-Cache Streaming Engine**: Sends strict `nocache_headers()`, exact `Content-Length` headers, and memory buffering to guarantee instant updates on Google Merchant Center Scheduled Fetches.
* **Zero Bloat & Zero Third-Party Dependencies**: 100% native WordPress code, lightweight, fast, and secure.

== Installation ==

1. Upload the plugin folder to the `/wp-content/plugins/` directory, or install the ZIP file via **Plugins > Add New > Upload Plugin**.
2. Activate the plugin through the **Plugins** menu in WordPress.
3. Navigate to **Settings > Product Feeds** to view your generated dynamic feed URLs.
4. Copy the **Google Shopping Feed URL** and paste it into your Google Merchant Center account under **Data sources > Add product data > Scheduled Fetch**.
5. Copy the **Trustmate Review Feed URL** and paste it into your Trustmate dashboard for automatic review tracking.

== Frequently Asked Questions ==

= Does this plugin work with SureCart? =
Yes! It has full native support for SureCart products, pricing, inventory statuses (`sc_inventory_status`), featured images, collections, tags, and product galleries.

= Does this plugin work with WooCommerce? =
Yes! It automatically detects WooCommerce installations and outputs compliant feeds from published WooCommerce products and product variations with `<g:item_group_id>`.

= How do Custom Labels (0-4) work? =
Navigate to **Settings > Product Feeds > Google Shopping Rules & Custom Labels**. You can configure rules for each slot: Price Range Tiers, Inventory Status, Product Category, Tag/Keyword Matching (e.g. `clearance:Clearance, sale:On Sale, bestseller:Best Seller`), or Custom Post Meta fields.

= Why does this plugin use extension-free REST URLs? =
Many modern WordPress hosts (SiteGround, Cloudflare, Hostinger, LiteSpeed) aggressively cache URLs ending in `.xml` on disk for up to 7 days (`DT:1`), causing Google Merchant Center to read stale prices and out-of-stock products. Our REST API endpoints (`/wp-json/world-inspire-product-feed/v1/google-shopping`) bypass static disk caches completely, delivering 100% real-time accuracy.

= How do I configure free shipping for international customers? =
Go to **Settings > Product Feeds > Multi-Country Shipping**. You can enter comma-separated ISO country codes (e.g. `US,CA,GB,JP,SG,HK,AE,MX`), set the shipping cost to `0.00`, and name the service `Standard Free Shipping`.

== Screenshots ==

1. Feed URLs & Health Dashboard: Dynamic REST API endpoints and real-time catalog status.
2. Google Shopping Rules & Custom Labels: Global fallback brand defaults, product taxonomies, NLP color/size/material detection, and custom labels 0-4.
3. Multi-Country Shipping: International destination targeting and custom shipping rates.
4. Live Diagnostics & Product Inspector: Catalog extraction audit, custom label rule matching traces, and raw XML simulator.

== Changelog ==

= 1.1.0 =
* Added Google Shopping Custom Labels (custom_label_0 to custom_label_4) with configurable rules: Price Tiers, Inventory Status, Category Mapping, Promotional Tag Keywords, and Custom Post Meta.
* Added WooCommerce variable product expansion with `<g:item_group_id>` linking parent and variant products.
* Added smart attribute extraction for `<g:size>`, `<g:material>`, and `<g:pattern>` with jewelry/apparel heuristic engines.
* Added Live Product Inspector & XML Simulator to Diagnostics tab with rule matching explanation traces.
* Enforced Google Shopping 100-character maximum length limit and XML entity escaping on all custom labels.
* Added 87 zero-dependency unit and mock E2E integration tests passing 100% green.

= 1.0.0 =
* Initial community release on WordPress.org.
* Native dual-engine support for SureCart and WooCommerce.
* Multi-country `<g:shipping>` generation.
* Smart color heuristic extraction engine.
* Anti-cache memory stream architecture.
* Real-time Trustmate product catalog feed.
