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.

OpenCartKeyCRMThe right key
Product without optionsProduct offerProduct SKU
Product + size MA separate optionUnique M option SKU
Product + size LA separate optionThe unique SKU of the L option
Several shopsShared directoryA 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 mechanismThe roleadvantageRestrictions
CRON + APIPeriodic reconciliation of balancesControlled queue and batch processingThere is a delay between launches
Webhook KeyCRMChange signalQuick reactionDetails sometimes need to be read through the API
OpenCart eventReaction to the site's orderImmediately reduces the local balanceRequires coordination with CRM
Manual synchronizationFirst launch and diagnosticsThe result is easy to controlNot 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:

  1. receives a page of data or a small packet;
  2. puts tasks in a controlled queue;
  3. processes them with a given pause;
  4. with 429 waits and repeats the operation;
  5. records the last successful position to avoid starting the import from scratch.

Safe Start Sync

  1. Back up and disable bulk manual edits for the first reconciliation.
  2. Export the SKU table from both systems and find empty and duplicate SKUs.
  3. Choose 5-10 products: no options, options, zero balance and reserve.
  4. Run the exchange only for the test set.
  5. Compare the quantity in KeyCRM, OpenCart and in the storefront.
  6. Simulate a sale on the site and a change in CRM.
  7. Check the repeat event, 429, temporary API unavailability and log.
  8. 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.

KeyCRM module for OpenCart Check your script

Related materials

How to connect KeyCRM to OpenCart Transfer of orders without duplicates