WP Manifestindependent plugin directory
manifest / ecommerce / kiotviet-pos-api-sync-for-woocommerce

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

★ 0stars
0forks

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.zip

WooCommerce 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

  1. External IDs are stored in product meta for stable mapping.
  2. API credentials are stored in WordPress options, not hard-coded.
  3. Sync runs manually and can also run on WP-Cron.
  4. Logs are written through a single logger service.
  5. Product sync and order export are separated for maintainability.
  6. 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