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.
Preparing for data transfer
Regardless of the data synchronization option, you must first:
-
Create products with SKUs in CRM: manually, by importing from a file, from publications, or via API;
-
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.
Transferring stock levels from keyCRM to your online store
There are two main methods you can use:
-
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.
-
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.
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:
-
«quantity» — total quantity of stocks;
-
«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.