Professional Documents
Culture Documents
Scheduled Serverless Lambda For Products Sync Between Zauru and Woocommerce
Scheduled Serverless Lambda For Products Sync Between Zauru and Woocommerce
Connect to an airtable (the credentials must be stored in an env variable) with this columns
and get all the DATA about the :
• woocommerce_key (text)
• woocommerce_secret (text)
• zauru_token (text)
example: https://egghead.io/lessons/node-js-connect-node-js-to-an-airtable-database
1.1.3 Continue navigating thru all the items that are inside of each category and store the
items object (in a woo commerce style) in an z_items_array.
1.1.4 Clean up the z_categories_array by removing duplicates and removing the elements of
z_categories_array that the “name” element is null
1.1.5 Fetch all the WooCommerce categories /products/categories, remove all attributes of
each object and only keep: id, name and parent, and store them in wc_categories_array.
1.1.6 Fetch all WooCommerce products /products, remove all attributes of each object and
only keep: id, name, regular_price, description, sku, manage_stock, stock_quantity, weight,
categories, and images. And store them in wc_items_array.
1.1.7 Use alasql to load the z_categories_array and wc_categories_array as different tables
and LEFT OUTER JOIN them by “name” to identify what operation to do in another column
(create/update/delete/nothing).
1.1.9 Fetch all the WooCommerce categories /products/categories, remove all attributes of
each object and only keep: id and name. and store them in wc_updated_categories_array.
1.1.10 Use alasql to load the z_items_array and wc_items_array as different tables and LEFT
JOIN them by “sku”/“code” to identify what operation to do in another column (create/update/
delete/nothing). See our last isProductUpdated method for reference (but verifying
wc_updated_categories).
REFERENCES:
3. Use as reference our project that does this in a not efficient way https://github.com/intuitiva/
woo-commerce-zauru-sync-products (it does like 3 API calls for EACH product, it updates 50
products in 15 minutes….)