Skip to main content

WordPress · Product sync

The plugin syncs your WooCommerce catalog with Neuroon through the endpoint:

POST/api/plugin/shops/{shopId}/products/sync

The sync is idempotent by externalId (typically the WP product ID). Resending the same product updates, it does not duplicate.

Sync modes

ModeWhen to use itBehavior
FULLInitial load or re-bootstrapMarks as absent any products that are not in the accumulated batch.
INCREMENTALDay-to-day (autosync, deltas)Only creates / updates the products sent; the rest stays untouched.

The plugin uses INCREMENTAL by default. It only triggers FULL when you click Reset & Resync All from the Products tab.

Batch size

LayerLimit
Plugin (client)50 products by default (Neuroon_Constants::DEFAULT_BATCH_SIZE = 50), configurable between MIN_BATCH_SIZE = 10 and MAX_BATCH_SIZE = 500 via the neuroon_batch_size option
Backend (server)up to 500 products per request

Citation: constants in wordpress-plugin/neuroon-search/includes/class-neuroon-constants.php (lines 42–48).

The plugin sends in small batches deliberately: it bounds the PHP memory footprint, avoids typical PHP-FPM timeouts (max_execution_time) and handles rate limits more gracefully. If your hosting allows it, raise neuroon_batch_size from the Products → Settings tab.

Auto-sync via WooCommerce hooks

The plugin hooks the following WooCommerce events and moves the corresponding product to PENDING state in its local table wp_neuroon_product_sync:

add_action('woocommerce_update_product', array(__CLASS__, 'on_product_updated'));
add_action('woocommerce_new_product', array(__CLASS__, 'on_product_created'));
add_action('woocommerce_product_set_stock', array(__CLASS__, 'on_stock_changed'));
add_action('before_delete_post', array(__CLASS__, 'on_product_deleted'));

Citation: hooks listed in wordpress-plugin/CLAUDE.md and registered in wordpress-plugin/neuroon-search/includes/product-sync-hooks.php.

Behavior:

  • Edited product → if it was SYNCED, it goes back to PENDING.
  • Created product → ends in PENDING (manual selection or autosync, depending on settings).
  • Stock change (woocommerce_product_set_stock) → re-sync.
  • Deleted product (before_delete_post) → removed from the local table; a follow-up job will emit DELETE /api/plugin/shops/{shopId}/products/{externalId}.

Local tracking table

Custom table: {prefix}_neuroon_product_sync.

CREATE TABLE wp_neuroon_product_sync (
product_id BIGINT(20) UNSIGNED NOT NULL,
status VARCHAR(20) NOT NULL DEFAULT 'PENDING',
last_synced_at DATETIME NULL,
last_modified_at DATETIME NOT NULL,
error_message TEXT NULL,
sync_attempts INT NOT NULL DEFAULT 0,
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (product_id),
KEY status (status),
KEY last_modified_at (last_modified_at)
);

Citation: schema in wordpress-plugin/CLAUDE.md (Database Schema section).

States:

StatusMeaning
PENDINGQueued, not sent yet.
PROCESSINGSent, awaiting response.
SYNCEDAccepted by the backend (200/201).
FAILEDBackend returned an error; see error_message.
NOT_SYNCEDProduct excluded by local rules (e.g. draft).

Endpoint response

Each /products/sync call returns a JSON with the aggregate of that batch:

{
"totalReceived": 100,
"newProducts": 50,
"updatedProducts": 47,
"skipped": 0,
"failed": 3,
"errors": [
{ "externalId": "123", "error": "Invalid price" }
],
"productsCount": 150,
"remainingProducts": 850
}

productsCount and remainingProducts reflect your global quota after the batch. The plugin shows those values in the Products tab and blocks new batches if remainingProducts == 0.

Latency (eventual consistency)

After the 200 OK, products go through the internal pipeline . Indexing takes 2 to 5 seconds. Until it finishes, an immediate search may not return them.

Rate limits

EndpointLimit
products/sync100/min
shops/me60/min
verification-data20/min

Citation: rate limits matrix summarized in the brief and applied by Neuroon_Rate_Limit_Handler.

The plugin captures 429 and respects Retry-After. If your shop has more than 6,000 products and you need a fast bootstrap, contact support to widen the window.

Quotas

The plan tied to your API Key defines maxProducts. The Products tab reads productsCount / maxProducts from GET /api/plugin/shops/me (5 min cache in the neuroon_shop_info_{md5(api_key)} transient).

Manual sync from the UI

  1. wp-admin → Settings → Neuroon Search → Products tab.
  2. Select products (DataTables 1.13.6 server-side).
  3. Click Sync selected. The UI fires wp_ajax_neuroon_start_sync and then polls wp_ajax_neuroon_sync_status.
  4. Each batch (100) is sent sequentially with usleep(100000) (100 ms) between batches to avoid saturation.

Forced resync

Products tab → Reset & Resync All marks every product as PENDING and triggers a FULL sync. Useful when:

  • You suspect the local table is out of sync with Neuroon.
  • You have changed attributes / categories in bulk.
  • You just migrated plans and need to re-validate the quota.

Next steps