ToToSync
Syncs featured products from POS API into WooCommerce — variable products,
by rindradev@gmail.com · github.com/mikohmick/totosync · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/mikohmick/totosync/archive/refs/heads/main.zipToToSync — WooCommerce POS Product Sync
Syncs featured products from a POS API into WooCommerce. Handles simple products, variable products (Colour + Measurement attributes), images, prices, stock levels, and automatic trash/restore when items appear or disappear from the API. Supports manual sync and configurable automatic sync (15 / 30 / 60 minutes) via WooCommerce's built-in Action Scheduler.
Requirements
| Requirement | Minimum version |
|---|---|
| WordPress | 5.8+ |
| WooCommerce | 5.0+ |
| PHP | 7.4+ |
Installation
- Upload the
totosyncfolder to/wp-content/plugins/totosync//wp-content/plugins/totosync/totosync.php /wp-content/plugins/totosync/autosync.php /wp-content/plugins/totosync/sync-listener.php /wp-content/plugins/totosync/script.js - Go to WordPress Admin → Plugins and activate ToToSync.
- That's it — no server cron or extra configuration required.
Usage
Manual sync
- Go to WordPress Admin → ToToSync.
- The Status card shows when the last sync ran and the API endpoint in use.
- Click Sync Now to pull the latest products from the POS.
- A progress bar tracks how many products have been processed.
- The Last Sync Log below shows what was created, updated, or trashed.
The button responds instantly — the sync runs in the background so you can navigate away at any time and it will still complete.
Auto Sync
The Auto Sync panel at the bottom of the page lets the plugin run on a schedule without any server-side cron configuration.
- Tick Enable Auto Sync.
- Choose an interval: Every 15 / 30 / 60 minutes.
- Click Save.
On first enable the sync fires immediately, then repeats on the selected interval. The Next run timestamp is shown after saving.
Each auto-sync run overwrites wp-content/uploads/totosync/autosync.log
with the results of that run (previous log is discarded). The log viewer on
the admin page refreshes every 5 seconds via AJAX while the page is open.
Disabling auto-sync (or deactivating the plugin) cancels all pending scheduled actions cleanly.
How It Works
| Scenario | What the plugin does |
|---|---|
| Product exists in API | Updates price, stock, category, and description |
| Product is new | Creates it in WooCommerce and downloads its image |
| Product removed from API | Moves it to Trash in WooCommerce |
| Trashed product reappears | Restored automatically on the next sync |
| Image URL is a private IP (192.168.x.x) | Skips the image; product is still synced |
| Image URL is a public FTP URL | Converts to HTTP and downloads it |
| Colour or Measurement field present | Creates/updates a variable product with attributes |
| No Colour and no Measurement | Creates/updates a simple product |
| Multiple API items share the same name | Grouped under one parent variable product; each colour/measurement combo becomes a separate variation |
Variable products
Items that share an itemName in the API (e.g. Cotton Roampers Set Of 3)
are automatically grouped under a single WooCommerce variable product.
Each unique combination of colour + measurement becomes its own variation
with its own SKU, price, and stock level.
The plugin detects existing variations by matching the stored attribute slugs directly from the database — not from the WooCommerce object cache — so all variations are found and updated correctly even when many items with the same name are processed in a single sync run.
Troubleshooting
Sync log shows "API returned HTTP 5xx" or connection errors The POS server is unreachable. Check the API URL on the admin page is accessible from your server:
curl -I http://shop.ruelsoftware.co.ke/api/FeaturedProducts/197.248.191.179
Products are created but have no images
The API is returning private-IP image URLs (e.g. ftp://192.168.x.x/...).
Images will be attached automatically on the next sync once the POS server
starts serving them from a public IP.
Sync Now button spins forever / sync never starts
Deactivate and reactivate the plugin to regenerate the listener secret, then
try again. If it still hangs, check that sync-listener.php is present in
the plugin folder and readable by the web server.
Auto Sync enabled but never runs
Action Scheduler requires WooCommerce to be active. Confirm WooCommerce is
installed and enabled. You can also check the schedule under
WooCommerce → Status → Scheduled Actions — search for
totosync_autosync_fire to see pending or past runs.
Changelog
2.3.0
- Added configurable Auto Sync using WooCommerce's Action Scheduler (no server cron required). Interval choices: 15 / 30 / 60 minutes.
- First enable fires an immediate sync, then repeats on the chosen interval. Changing the interval reschedules without triggering an extra run.
- Each auto-sync run overwrites
wp-content/uploads/totosync/autosync.log(only the latest run's log is retained). - Live log viewer in the admin panel polls via AJAX every 5 seconds.
- Deactivation now cancels all pending scheduled actions.
2.2.1
- Fixed: multiple variations of the same parent product (same
itemName, different colour/measurement) were not all being created. The children scan now queries the database directly instead of using the WC object cache, and compares attribute slugs rather than term labels, so every variation is matched correctly during a single sync run. WC_Product_Variable::sync()called after each variation save to keep the parent's price range and stock status up to date immediately.
2.2.0
- Removed WP-Cron entirely — sync is manual-only via Sync Now button.
- Sync Now button now responds instantly (non-blocking listener via
sync-listener.php); the old flush/fastcgi_finish_request approach is gone. - Items with only colour OR only measurement now correctly become variable products instead of simple products.
- Colour and measurement attributes handled independently — missing one no longer prevents the other from being registered.
- Existing simple products auto-converted to variable when a variation arrives.
- New variations explicitly set to
publishstatus. - Empty attribute postmeta no longer written (prevents WooCommerce treating all variations as matching "any").
2.1.3
- Clear transients on deactivation; full cleanup on uninstall.
2.1.0
- Handle private-IP image URLs gracefully (sync product, skip image).
- Convert
ftp://image URLs tohttp://for public-IP POS servers. - Trash products/variations that disappear from the API.
- Restore trashed products automatically when they reappear in the API.
2.0.0
- Variable product support with Colour and Measurement attributes.
1.0.0
- Initial release.
Support
Open an issue on the GitHub repository.