Balance synchronization between KeyCRM and OpenCart is required when the same item is sold through the site, marketplaces, or managers. Its purpose is not just to copy the number, but to correctly match the product and variant, take into account the reserve, choose the warehouse and not overwrite the newer value with old data.
Why transferring orders is not the same as syncing balances
The native integration of keyCRM with OpenCart transfers the order, but the reverse update of balances on the site requires an API implementation. This is directly stated in the actual official keyCRM instructions on balances.
Expanded KeyCRM module for OpenCart automates this exchange: updates inventory and prices, supports variants and options, product import/export, CRON and webhook events. But even with a ready-made module, accounting rules must first be defined.
Choose the source of truth
Before starting, decide where the manager has the right to change the balance:
- KeyCRM → OpenCart. CRM manages inventory, reserves and sales from all channels; the site only shows the available quantity.
- OpenCart → KeyCRM. The store is the master catalog and passes the actual balance to CRM.
- Bilateral exchange. Record versioning, clear events, and a conflict resolution rule are required. A simple "last entry wins" is often not enough.
Dangerous scenario: CRON retrieves the old balance from CRM at the same time as the order is placed in OpenCart. Without the priority rule, the site may briefly return an already sold unit to availability.
Item and Option SKU - Mapping Key
KeyCRM and OpenCart have their own internal IDs, so they cannot be directly compared. The SKU is a stable business key. It should be:
- non-empty for each product;
- unique within the entire catalog;
- separately for each option — size, color or configuration;
- the same in KeyCRM and OpenCart;
- unchanged after the connection is established or changed synchronously in both systems.
In the standard OpenCart configuration, the SKU field can only be in the parent product. Option synchronization often requires an additional article field at the option value level. Without it, CRM cannot distinguish, for example, an M T-shirt from an L T-shirt.
| OpenCart | KeyCRM | The right key |
|---|---|---|
| Product without options | Product offer | Product SKU |
| Product + size M | A separate option | Unique M option SKU |
| Product + size L | A separate option | The unique SKU of the L option |
| Several shops | Shared directory | A single agreed article system |
Quantity, reserve and several warehouses
Physical quantity and reserve are available in KeyCRM. A showcase usually requires an available quantity rather than the entire physical balance. The formula depends on the business process, but most often it is:
available for sale = quantity − reserve
If there are several warehouses, record which of them serve the site: one specific one, the sum of selected ones, or individual balances by location. Don't summarize scrap, transit, or offline inventory without an explicit business decision.
API, CRON and webhook: what is responsible for what
| The mechanism | The role | advantage | Restrictions |
|---|---|---|---|
| CRON + API | Periodic reconciliation of balances | Controlled queue and batch processing | There is a delay between launches |
| Webhook KeyCRM | Change signal | Quick reaction | Details sometimes need to be read through the API |
| OpenCart event | Reaction to the site's order | Immediately reduces the local balance | Requires coordination with CRM |
| Manual synchronization | First launch and diagnostics | The result is easy to control | Not suitable for permanent work |
A robust scheme combines webhook for speed and CRON for reconciliation. If one event does not occur, the scheduled process will correct the discrepancy.
API limits, pause and queue
For up-to-date keyCRM help, one API key has a limit of up to 20 requests per minute; the recommended pause is about three seconds. Excess returns 429. Therefore, a catalog with thousands of items cannot be synchronized in a parallel loop without speed limitation.
Correct process:
- receives a page of data or a small packet;
- puts tasks in a controlled queue;
- processes them with a given pause;
- with
429waits and repeats the operation; - records the last successful position to avoid starting the import from scratch.
Safe Start Sync
- Back up and disable bulk manual edits for the first reconciliation.
- Export the SKU table from both systems and find empty and duplicate SKUs.
- Choose 5-10 products: no options, options, zero balance and reserve.
- Run the exchange only for the test set.
- Compare the quantity in KeyCRM, OpenCart and in the storefront.
- Simulate a sale on the site and a change in CRM.
- Check the repeat event,
429, temporary API unavailability and log. - Only after that, run the entire directory in batches.
Typical causes of an incorrect balance
- the same SKU in several products or options;
- the article contains an invisible space or a different case;
- the physical quantity is used without deducting the reserve;
- the wrong syllable is chosen or extra syllables are summed up;
- two CRON tasks are running at the same time;
- an old batch update overwrites a newer event;
- The API responds
429, but the integration does not repeat the query; - the OpenCart cache shows the old value after updating the database.
Need up-to-date balances without manual import?
Build Zone's comprehensive integration supports items and options, pricing, balances, import/export, CRON, webhooks, and link validation.