Download Shopper Information in SFRA

When you implement an SFRA-based storefront, consider providing your shoppers with a mechanism to download their data. The plugin_datadownload cartridge provides a sample implementation of this capability.

In the sample implementation, registered users see a Download My Data button on the My Account page. When a shopper clicks this button, SFRA downloads a JSON file to the shopper's browser. This file contains the following information:

  • Profile
  • Address
  • Payment instruments
  • Orders
  • Wish lists
  • Gift registries
  • Shopping lists

The JSON file illustrates the type of information to provide to your shoppers. Your business can provide different data in a different format. To use the sample implementation, uploading the plugin_datadownload cartridge into your instance and add the cartridge to your cartridge path.

This sample file shows the type of information you can provide to the shopper.

The sample implementation provides a Download my data button in the accountDashboard.isml template.

When the shopper clicks the button, the Account-DataDownload route is called. This route is implemented in Account.js.

This route relies on the helper script dataDownloadHelper.js, which provides several helper functions, such as getWallet(profile), getWishlists(customer, ProductListMgr), and so on. The helper script exports getProfileData, which calls the helper functions, constructs the JSON string, and returns the result to the shopper's browser.