WP-CLI Support

Reading Time: 4 minutes
Download Markdown

Overview

WPiko Chatbot Pro includes WP-CLI commands for syncing your WooCommerce product catalog from the command line. This is the recommended approach for sites with large catalogs (1,000+ products) or environments where WP-Cron is unreliable.

Note: order syncing was retired in WPiko Chatbot Pro 2.1.0. Orders are no longer uploaded to OpenAI, so there is nothing to sync. The chatbot looks orders up live instead. See Order Assistance.

Why WP-CLI?

Web-based sync (admin panel)WP-CLI sync
Limited by PHP max_execution_time (typically 30–300s)No timeout — runs until complete
Limited by PHP memory_limit (128–256MB)Uses memory-efficient streaming
Depends on WP-Cron (can be blocked by caching/performance plugins)Runs independently — no WP-Cron dependency
Progress tracked via AJAX pollingReal-time progress bar in terminal

Requirements

  • SSH access to your server
  • WP-CLI installed (installation guide)
  • WPiko Chatbot (free) plugin active
  • WPiko Chatbot Pro plugin active with a valid license
  • WooCommerce active
  • WooCommerce Integration enabled in WPiko Chatbot settings

Available Commands

Sync Products

Syncs all published WooCommerce products to OpenAI’s Vector Store.

wp wpiko-chatbot sync products

What it does:

  1. Queries all published products in batches of 100
  2. Formats each product (name, price, SKU, categories, attributes, etc.) based on your field preferences
  3. Streams the data to a temporary JSON file (memory-efficient — no large arrays held in PHP memory)
  4. Uploads the file to OpenAI’s Vector Store
  5. Removes the previous products file from OpenAI
  6. Updates the sync status in your WordPress database

Example output:

Found 4,500 published products. Starting sync...
Processing products  100% [========================================] 4,500 / 4,500
Products file built: 8.2 MB
Uploading to OpenAI...
Success: Successfully synced 4,500 products to OpenAI.

Check Sync Status

Displays the product sync status, whether Order Assistance is enabled, and whether old order files have been cleaned up from OpenAI.

wp wpiko-chatbot sync status

Example output:

--- Product Sync Status ---
  Status:    Completed
  Progress:  100%
  Last sync: 2026-02-18 14:30:00
  File ID:   file-abc123xyz

--- Order Assistance ---
  Lookup: Enabled
  Old order file cleanup: Complete

Total published products: 4,500
WooCommerce Integration:  Enabled

Sync Orders (retired)

wp wpiko-chatbot sync orders no longer uploads anything. Since version 2.1.0 it stops with the message “Order uploads have been retired. Enable Order Assistance in WooCommerce Integration for controlled live lookups.” Remove any server cron jobs that run this command.

Server Cron Scheduling

Instead of relying on WP-Cron, you can schedule product syncs using your server’s crontab for precise, reliable execution.

crontab -e

Example schedules

# Sync products every 6 hours
0 */6 * * * cd /path/to/wordpress && wp wpiko-chatbot sync products --quiet 2>&1 | logger -t wpiko-sync

# Sync products daily at 3:00 AM
0 3 * * * cd /path/to/wordpress && wp wpiko-chatbot sync products --quiet

Notes on cron scheduling

  • --quiet suppresses the progress bar and informational output (recommended for cron)
  • cd /path/to/wordpress — replace with your actual WordPress installation path
  • If you have multiple PHP versions, you may need to specify the full path to WP-CLI: /usr/local/bin/wp
  • For multisite, add --url=example.com to target a specific site
  • Pipe to logger or a log file to capture any error output:
0 3 * * * cd /var/www/html && wp wpiko-chatbot sync products --quiet >> /var/log/wpiko-sync.log 2>&1

Disabling WP-Cron Auto-Sync

If you switch entirely to WP-CLI cron, disable the WP-Cron–based product sync:

  1. Go to WPiko Chatbot → Setup & AI → AI Configuration and open WooCommerce.
  2. Set Product Catalog Auto-Sync to Disabled.

The manual “Sync Existing Products” button in the admin panel still works as a one-time trigger.

Troubleshooting

“WooCommerce is not active”

Make sure WooCommerce is installed and activated.

“WooCommerce Integration is not enabled”

Enable it in WPiko Chatbot → Setup & AI → AI Configuration → WooCommerce.

“WPiko Chatbot Pro license is not active”

Activate your license key in WPiko Chatbot → Pro Features → License Activation.

“Another product sync is already in progress”

A previous sync may still be running or a stale lock exists. Wait a few minutes and try again. You can check with wp wpiko-chatbot sync status. Locks automatically expire after 10 minutes (CLI) or 5 minutes (web).

“Order uploads have been retired”

You ran sync orders. Remove that command from your cron jobs and turn on Order Assistance instead.

Command not found

Ensure WP-CLI is installed and the WPiko Chatbot Pro plugin is active:

wp plugin list | grep wpiko
Have a Question?