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)100 products per request (Neuroon_Product_Sync_Manager::BATCH_SIZE = 100)
Backend (server)up to 500 products per request

The plugin sends in batches of 100 deliberately: it bounds the PHP memory footprint, avoids typical PHP-FPM timeouts (max_execution_time) and handles rate limits more gracefully.

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'));

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}.

For custom integrations: the plugin handles this auto-sync + DELETE by itself. If you build your own integration (Next.js, Nuxt, .NET, etc.) you must replicate three things the plugin does silently: (1) detect deleted products and emit DELETE; (2) re-queue edited products; (3) periodically reconcile local vs remote so you don't pile up orphan products. Full pattern in plugins/custom/server-to-server.

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)
);

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

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