Asynchronous synchronization plugin that keeps WooCommerce products aligned with PostgreSQL (public.inv_items) through event queue processing.
- Real integration challenge solved with a robust queue-based design.
- Focus on data consistency and operational resilience.
- Suitable for high-volume catalog synchronization scenarios.
- WooCommerce hooks capture product changes.
- Internal queue table for event processing.
- Batch worker via WP-Cron.
- SKU-based upsert into PostgreSQL.
- Configurable deletion mode (
soft/hard).
- WordPress + WooCommerce
- PHP (
pgsqlextension) - PostgreSQL
- Install the plugin in
wp-content/plugins. - Activate it in WordPress.
- Configure the PostgreSQL connection in plugin settings.
- Run the initial bootstrap and queue processing.
wp altek-sync bootstrap --batch=500
wp altek-sync run-workerThe settings screen shows:
- Total WordPress products.
- Total Altek products (Postgres).
- Queue status (
pending,retry,processing,failed). - Table with the latest 20 events (SKU, event, status, attempts, error).
Compare and enqueue missingbutton.Process queue nowbutton.
Compares WooCommerce SKUs against Postgres and enqueues only missing ones:
wp altek-sync bootstrap --batch=500Run the worker manually (optional):
wp altek-sync run-worker{wp_prefix}altek_sync_queue
Statuses:
pendingprocessingretrydonefailed
item:trim(product.sku). If numeric and shorter than 9 digits, it is left-padded with zeros to 9 digits.codigobarras:product.skunombre:product.namenombreweb:product.nameexistencia:product.stock_quantity(when stock is managed)costoestandar:product.regular_pricecostopromedio:product.regular_priceid_altek:product.id(WordPress ID)imagen: featured image URLbloqueado:FALSEon create/updatecostoultimacompra(optional):meta _altek_last_costif presentidcategoria(optional): first Woo categoryobservaciones(optional):short_descriptionalto(optional):product.heightwhen numericancho(optional):product.widthwhen numeric
Before production:
- Create uniqueness on normalized SKU (
upper(trim(item))). - Define an official product deletion policy (soft/hard).
- Use a least-privilege PostgreSQL user.
- Confirm SSL (
sslmode=require) when applicable.
- Created by Carlos Garzón
- Software Engineer, Fullstack Developer.
MIT