How to Send Stock Balances From keyCRM to Online Stores

We explain how to set up the transfer of stock balances so that all systems used have up-to-date data.
Written by Владислав Пономарь
Updated 1 month ago

Maintaining up-to-date stock levels across all systems is important to avoid problems with orders for out-of-stock products and to ensure timely restocking.

If you have an online store based on CMS (WordPress, Opencart, PrestaShop, CS-Cart, etc.) or your own development, you can use the help of a programmer to transfer stock levels to your online store and implement data exchange using our API.

First, check with the website programmer to see if it is technically possible to place your scripts for data exchange. Then contact the programmer to implement the script for obtaining stock balances on the website.

Preparing for data transfer

Regardless of the data synchronization option, you must first:

  1. Create products with SKUs in CRM: manually, by importing from a file, from publications, or via API;

  2. Activate and configure stocks management.

  3. Upload initial balances to keyCRM.

When doing so, keep the following key points in mind:

  • Data synchronization between systems occurs by product SKU. Therefore, make sure that it is the same for a single product in all systems;

  • Each product and product variant must have its own unique SKU, as it is a separate unit of stocks management;

  • To work with products via API, you may need the product ID (productId) and product variant ID (offerId) from CRM. You can get them in the export file or by requesting a list of products or product variants via API.

Note! The API keyCRM has a limit of 60 requests per minute per API key. Therefore, we recommend setting a pause of 1 second between requests to avoid exceeding the limit.

Transferring stock levels from keyCRM to your online store

There are two main methods you can use:

  1. Receive all stock levels at regular intervals: to do this, you need to place a script on your website that will use the API to connect to keyCRM, receive stock levels for products, and record them for the corresponding products on the website. This option is more convenient for periodic full reconciliation of stock levels.

  2. Receive information about changes in stock: to do this, you can configure webhook sending from keyCRM to your website. This way, you will receive the updated stock level immediately after it changes in the CRM.

Note! To implement these methods, you need a programmer who will write a script for your website that performs the necessary operations for data exchange.

Features of obtaining a list of stocks

In the method of obtaining a list of stocks, there are several possible filters when forming a request:

  • Filter by product variant identifier — when specifying «offers_id» or several separated by commas (product variant identifier in keyCRM), stocks will be obtained only for the specified variants;

  • Filter by product variant SKU — when you specify «offers_sku» or several separated by commas (product variant SKU), you will receive stocks only for variants with these SKUs;

  • Receive stocks for each warehouse separately — the «warehouse» array is added with details of stocks for each warehouse.

When receiving total stocks for all warehouses, as well as when receiving stocks for each warehouse separately, you will receive the quantity in two fields:

  1. «quantity» — total quantity of stocks;

  2. «reserve» — total quantity of reserved stocks.

Accordingly, you can subtract the reserve from the total stock on the website side to record the quantity available for sale, taking into account the reserve for products.

An example of an object for obtaining stock for each warehouse:

"warehouse": [
     {
          "id": 1, // warehouse ID
          "name": "Main", // warehouse name in CRM
          "quantity": 98, // total quantity of stock
         "reserve": 8 // total amount of reserved stock
     },
     {
          "id": 2, // warehouse ID
          "name": "Store", // warehouse name in CRM
          "quantity": 35, // total amount of stock
          "reserve": 3 // total amount of reserved stock
     }
]

If your balances are entered on the website or maintained in a separate warehouse program, you can choose another scheme for data exchange.

Now you can ensure that the balances on your websites are up to date and accurate, allowing you to efficiently process orders and maintain stocks management in one place.

Tags: stock, transferring stock to an online store, website, updating stock, updating quantity, products by API, API stock, product synchronization, stock synchronization, script for obtaining stock on the website
Did this answer your question?