npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@code-nl/shopify-to-firestore

v1.0.2

Published

Package with methods to store and remove Shopify JSON Object simply to and from Firestore.

Readme

Shopify to Firestore

Provides functionality to:

  • Store data from Shopify in Cloud Firestore
  • Delete data of Shopify from Cloud Firestore

How to use

npm install @code-nl/shopify-to-firestore -- save

Store data

Load the storetoFirestore() function:

const { storeToFirestore } = require('@code-nl/shopify-to-firestore');

To use the storeToFirestore method :

storeToFirestore(firestore, shopifyDomain, documentRoot, documentId, sfyObject, extractToCollections);

Note that this returns a Promise so it is advisable to put this in your promise chain.

firestore             | object    | This is the reference to your Cloud Firestore instance (firebase.firestore())
shopifyDomain         | string    | This is the myshopify.com domain name of your Shopify Instance
documentRoot          | callback  | This is a callback function that returns the Firestore collection root of the Shopify object you want to store (see below for more info)
documentId            | string    | The unique ID of the Shopify object
sfyObject             | object    | The Shopify object that you want to store
extractToCollections  | array     | Array with collection options to extract specific elements to separate collections (see below for more info)

Delete data

Load the deleteFromFirestore() function:

const { deleteFromFirestore } = require('@code-nl/shopify-to-firestore');

To use the deleteFromFirestore method :

deleteFromFirestore(firestore, shopifyDomain, documentRoot, documentId, extractToCollections);

Note that this returns a Promise so it is advisable to put this in your promise chain.

firestore             | object    | This is the reference to your Cloud Firestore instance (firebase.firestore())
shopifyDomain         | string    | This is the myshopify.com domain name of your Shopify Instance
documentRoot          | callback  | This is a callback function that returns the Firestore collection root of the Shopify object you want to delete (see below for more info)
documentId            | string    | The unique ID of the Shopify object you want to delete
extractToCollections  | array     | Array with collection options to delete the related separate collections (see below for more info)

documentRoot

The contains a callback to the Cloud Firestore collection where the main data is stored. The first argument that is passed is the shopify domain name. An example of the callback can be:

/**
 * Helper to get the Shopify orders root
 * @param {string} shopifyDomain The myshopify.com domain name
 */
exports.getOrderDocRoot = (shopifyDomain) => { 
  return module.exports.getShopDocRoot(shopifyDomain).collection('sfyOrders');
};

In this case getOrderDocRoot is the callback you will have to pass on. The sfyOrders is the collection name that is used as subcollection in the shops collection.

extractToCollections

This contains an array of objects which provides a config for linked elements that needs to be stored or removed.

An example:

  // set the collections that needs to be extracted to a main collection
  const extractToCollections = [
    {
      name: 'fulfillments',
      collection: getFulfillmentDocRoot,
      parentDocRef: 'orderId',
      documentId: 'id'      
    }
  ];

In this case the fulfillments array in the Shopify object will be stored as seperate document(s) in the getFulfillmentDocRoot collection. The parentDocRef will contain the ID of the parent document. documentId is the unique ID that is used to store the extracted document in.