Export related data as CSV
This example shows you how to create a Smart Action "Export orders as CSV" that allows a user to download all the orders associated to a customer.

Requirements
The json2CSV npm package
How it works
Directory: /models
This directory contains:
the
customers.jsfile where thecustomersmodel is declared.the
orders.jsfile where theordersmodel is declared
Directory: /forest
This directory contains the customers.js file where the smart action Export orders as CSV is declared.
Directory: /utils
This directory contains a csv-exporter.js file where the method to export the orders as CSV is declared.
Directory: /routes
This directory contains the customers.js file where the logic of the smart action is implemented.
Last updated
Was this helpful?