Skip to main content

Stock synchronization

Stock synchronization is done by default once in 6 hours. At this time, all stocks will be grabbed from NetSuite and imported in Magento. 

The relevant stock settings can be found at NetSuite->Settings->Stock Options:

Parameter nameExample valueDescription
Location internal id1NetSuite supports multiple stock locations (warehouses). Magento does not, so it is necessary to specify the location from where Magento will grab stocks. If you need to grab from multiple locations, you can create a fake location in NetSuite (i.e. "Web"), then write a SuiteScript to combine stocks in there (i.e. add stocks from all other locations). This way Magento can still function by grabbing stocks from a single location.
Saved Stock search internal id12See below
Page size for the saved search query500The stock information is paged when grabbed. This value defines how many stock values are grabbed at once. 500 is the maximum NetSuite will allow.
Update the stocks every N hours6This value defines the frequency of the updates. Based on your catalog size, you can tweak this up or down.
Stock stored at location level?YesWhile by default the stock information is present at location level, some users may choose to expose it as a custom field at product level. This flag instructs the connector on where to look for stock information.
Quantity field namecustitem_web_inventoryThe exact field name that contains the stock number. For fields at product level, only custom fields are accepted. For fields at location level you can specify either custom or standard fields. A new setting will appear, "Quantity field type", where you can define whether the field is standard or custom.

Saved stock search

Since stock update is a frequent operation on all products, we wanted to make it as fast as possible. Instead of querying NetSuite for all product information then extracting the stock, a saved search must be created so to grab only the fields we care about. The saved search must contain only 2 fields (it can contain more but they will be ignored):

  • product internal id
  • the field that contains the stock number that was defined in the "Quantity field name" setting

If the "Quantity Field Name" is at location level, then you will be getting a row for each location. Mitigate this by adding a filter criteria to the search to list only the location you are grabbing from (the one that you defined in "Location internal id")

If you don't use stocks for specific product types (i.e. matrixes do not have stocks, only their subitems have), filter them out with criteria conditions to prevent unnecessary data processing.

Note that it is required to create the saved search as described above and put its internal NetSuite id inside the "Saved Stock search internal id" setting, stocks will not be imported otherwise.