I did an inventory integration so as to update stock qty for Wix loaded products from an outside source (CSV or Google Spreadsheet), looking up by SKU. Any ideas if Wix provides an API method so as to look to directly find a SKU in the loaded catalog? Here is how I’m currently doing it.
Based on Wix API documentation, I did the following:
– Get the OAuth authentication token for the API calls. Also, you can use the “Test” token provided by Wix.
– Wix has an internal ID for each product loaded, so you can’t do a direct SKU reference like other platforms like Magento do.
– To identify each product by SKU first we need to get all products collection with “wixapis.com/stores/v1/products/query” call, with “includeVariants: true” post parameter.
– Stock is saved in each “variant” of a product, thats why we add this.
– Get the inventory collection from “wixapis.com/stores/v2/inventoryItems/query” call, that will provide the inventory data for each variant.
– Then look for SKU in products collection, get its variant ID and look for the inventory data for that with the ID.
– Finally use “wixapis.com/stores/v2/inventoryItems” call with inventoryID parameter to update its stock qty. Got to send some post fields as documentation explains.
Thanks!
2
Answers
Be careful that "wixapis.com/stores/v1/products/query" has a pagination with a limit of 100 products per page, so the paging parameter with limit and offset must be used to get all data if your catalog goes beyond 100 products.
Actually,wix provides api that queries products or variants by skus directly.
filter-and-sort
query-products
query-store-variants
Attention,query-products filter is a lettle irritable,it’s String which differ from query-store-variants filter Object