3. Stock Sync
This document describes the fields required to successfully sync stock quantities with Magento products. This type of sync is one-way. Magento will fetch stock quantities from Pylon with the necessary information.
3.1 Terminology and Fields
The names of the fields in Pylon can be different from the names of the fields in Magento. The following table describes the fields and their types.
Field | Type | Description |
|---|---|---|
Pylon ID | text | A unique identifier for the product in Pylon. |
Pylon UID | text | A unique identifier for the product in Pylon. |
SKU | text | A unique identifier for the product in Magento. |
Last Modified Date | datetime | The datetime of the last stock movement in Pylon. Format: YYYY-MM-DD HH:MM:SS. |
Stock Quantity | int | The quantity of the product currently in stock and available for sale. |
Stock Status | boolean | Indicates if the product is "In Stock" or "Out of Stock". |
Allow Backorders | boolean | Specifies if backorders are allowed. Values can be "Allow Backorders" or "Do Not Allow Backorders". |
Out of Stock Threshold | int | The quantity below which the product is considered out of stock and cannot be sold. |
Availability | select | The product’s availability status, aligned with Skroutz XML definitions: |
-In Stock: Products available for Express delivery. | ||
-Available from 1 to 3 days: Products that can be delivered within 1 to 3 days. | ||
-Available from 4 to 10 days: Products not immediately available and delivered within 4 to 10 days. | ||
-Available up to 30 days: Products available only upon order, with a maximum delivery time of 30 days. |
3.2 Endpoint
Consult the following documents for
3.2.1 Required fields
Field | Type | Sync | Description |
|---|---|---|---|
Pylon ID | text | - | A unique identifier for the product in Pylon. |
Pylon UID | text | - | A unique identifier for the product in Pylon. |
SKU | text | - | A unique identifier for the product in Magento. |
Last Modified Date | datetime | - | The date and time when the product was last modified in Pylon. |
Stock Quantity | int | Yes | The quantity of the product currently in stock. |
Availability | select | No | The product’s availability status, aligned with Skroutz XML definitions. |
Default availability for products with stock is In Stock.
3.2.2 Optional fields (Phase 2)
Field | Type | Sync | Description |
|---|---|---|---|
Allow Backorders | boolean | No | Specifies if backorders are allowed. Values can be **Allow Backorders" or "Do Not Allow Backorders". Backorder products are considered in stock for Magento. |
Out of Stock Threshold | int | No | The quantity below which the product is considered out of stock and cannot be sold. |
3.2 The process
Magento will query Pylon for stock quantities using the aforementioned endpoint. The query will return a list of products with their respective data filtered by the last modified date to minify the required data to compare.
Magento will then compare the stock quantities with the existing stock quantities in Magento.
If the stock quantities are different, Magento will update the stock quantities in Magento with the stock quantities
3.3 Warehouses
We have 3 warehouses
Menemeni (Called "Κεντρικό" on Pylon)
Oraiokastro
Physical Store Menemeni (Called "Κατάστημα" on Pylon)
The total available quantity for sale in the store is the sum of the available quantities in menemeni and oraiokastro. The quantity that's in physical store Menemeni, is not included in the salable quantity.
3.4 Requirements
Whatever doesn't have quantity in Pylon will be considered as " Out of Stock " in Magento. Thus the product will no longer be sold. The " Availability " will be set to " Μή Διαθέσιμο " in Magento and " Status " becomes Disabled
We need to expose the total available quantity for sale in Magento. The total available quantity for sale in Magento is the sum of the available quantities in Menemeni and Oraiokastro. The quantity that's in Physical Store Menemeni, is not included in the salable quantity.
There are very few products that we don't keep stock for. Usually expensive bicycles. For those products normally we need to handle with backorders but because of the small amount the business side needs to handle internally without the sync modifying the stock. If the need arises we will check in Phase 2. I propose creating a flag in Pylon for those products so that they're not included in stock updates
Optional Webhook for realtime updates from Pylon (Phase 2)
Pylon will send a webhook to Magento when the stock quantities are updated in Pylon. The webhook will contain the Pylon ID, SKU, Pylon UID, and stock quantity.