WooCommerce POS Sync Engine Showcase
This repository is a public-safe architecture showcase inspired by a production WooCommerce to Kiotviet POS integration. It does not contain client code, credentials, private endpoints, business-specific rules, or proprietary data.
by Shashika De Silva · github.com/shashikadesilva27/kiotviet-pos-api-sync-for-woocommerce · 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/shashikadesilva27/kiotviet-pos-api-sync-for-woocommerce/archive/refs/heads/main.zipWooCommerce KiotViet POS Sync Engine - Showcase
This repository is a public-safe architecture showcase inspired by a production WooCommerce to Kiotviet POS integration. It does not contain client code, credentials, private endpoints, business-specific rules, or proprietary data.
What this demonstrates
- WordPress/WooCommerce plugin architecture
- OAuth/API client pattern for KiotViet POS system
- Product import and update workflow
- Variable product and variation mapping
- Stock and price synchronization
- Admin settings and manual sync actions
- Sync logging and retry-friendly design
- Order export hook pattern
Important privacy note
This is not the original commercial project. All identifiers, domain names, credentials, and client-specific implementation details have been removed or replaced with placeholders.
Architecture
WooCommerce Admin | v Settings + Sync UI | v POS API Client ----> Token endpoint / Product endpoint / Inventory endpoint | v Product Sync Service | +--> Create/update simple products +--> Create/update variable products +--> Match variations by external product ID or SKU +--> Update price and stock +--> Log sync results
WooCommerce Order Hook | v Order Export Service ----> POS order endpoint
Key design choices
- External IDs are stored in product meta for stable mapping.
- API credentials are stored in WordPress options, not hard-coded.
- Sync runs manually and can also run on WP-Cron.
- Logs are written through a single logger service.
- Product sync and order export are separated for maintainability.
- Raw API responses are never exposed publicly.
Suggested production hardening
- Move credentials to environment variables where possible.
- Add background queue for high-volume imports.
- Add idempotency keys for order exports.
- Add transient/object caching for token reuse.
- Add admin capability checks and nonces to every action.
- Add retry/backoff for API rate limits and temporary failures.
Repository structure
pos-sync-showcase.php includes/ class-pos-api-client.php class-pos-product-sync.php class-pos-order-export.php class-pos-admin.php class-pos-logger.php assets/js/admin-sync.js docs/ sync-flow.md