WP-CLI Support
Overview
WPiko Chatbot Pro includes WP-CLI commands for managing WooCommerce product and order synchronization directly from the command line. This is the recommended approach for sites with large product catalogs (1,000+ products) or environments where WP-Cron is unreliable.
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 polling | Real-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:
- Queries all published products in batches of 100
- Formats each product (name, price, SKU, categories, attributes, etc.) based on your field preferences
- Streams the data to a temporary JSON file (memory-efficient — no large arrays held in PHP memory)
- Uploads the file to OpenAI’s Vector Store
- Removes the previous products file from OpenAI
- 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.
Sync Orders
Syncs recent WooCommerce orders to OpenAI’s Vector Store.
wp wpiko-chatbot sync orders
Prerequisites: Orders auto-sync must be enabled in the admin panel (WooCommerce Integration → Recent Orders Auto-Sync). The number of orders synced is determined by the limit you set there (e.g., 50, 100, 200).
What it does:
- Fetches the most recent orders (based on your configured limit)
- Formats order data (ID, status, dates, items, tracking, etc.) based on your field preferences
- Uploads to OpenAI with automatic retry and exponential backoff
- Replaces the previous orders file
Check Sync Status
Displays the current sync status for both products and orders.
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
--- Orders Sync Status ---
Auto-sync: 100
Status: completed
Last sync: 2026-02-18 14:35:00
File ID: file-def456uvw
Total published products: 4,500
WooCommerce Integration: Enabled
Server Cron Scheduling
Instead of relying on WP-Cron, you can schedule sync jobs using your server’s crontab for precise, reliable execution.
Edit your crontab
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
# Sync orders every hour
0 * * * * cd /path/to/wordpress && wp wpiko-chatbot sync orders --quiet
# Sync orders every 30 minutes
*/30 * * * * cd /path/to/wordpress && wp wpiko-chatbot sync orders --quiet
Notes on cron scheduling
--quietsuppresses 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.comto target a specific site - Pipe to
loggeror 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, you can disable the WP-Cron–based auto-sync:
- In your WordPress admin, go to WPiko Chatbot → AI Configuration → WooCommerce Integration
- Set Product Catalog Auto-Sync to Disabled
- Set Recent Orders Auto-Sync to the desired order limit (this sets how many orders to sync, but you can leave the auto-schedule to WP-CLI)
The manual “Sync Products” button in the admin panel will still work 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 → AI Configuration → WooCommerce Integration.
“WPiko Chatbot Pro license is not active”
Activate your license key in WPiko Chatbot → 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).
“Orders auto-sync is disabled”
Set a value other than “Disabled” in the admin panel under Recent Orders Auto-Sync (e.g., 50 or 100 orders).
Command not found
Ensure WP-CLI is installed and the WPiko Chatbot Pro plugin is active:
wp plugin list | grep wpiko