Search for Products in Less Than 100 Lines of Code With the OrderCloud JavaScript SDK

March 10, 2021

Category: B2B eCommerce

B2B businesses need to be hyper focused on the digital experience today as the line between B2B and B2C continues to blur. This means that they need to be equipped with fast, agile technology that can meet changing customer needs. 

As B2B buyers adopt more B2C-like tendencies, businesses should consider adding those features and functionalities to their own user experiences. One of the most important features today is search. B2B product catalogs are typically much larger than B2C, sometimes including thousands of SKUs. The ability to accurately search for the products is a feature that will differentiate one business from the next. 

Premium Search on OrderCloud

OrderCloud features Premium search, which is the next evolution in search technology offered on the OrderCloud platform, powered by Elasticsearch. Premium search provides many advantages on OrderCloud, such as: 

  • Performance: The observable speed and responsiveness of end-user applications are significant for large data sets in particular.
  • Better Search Results: Overall, you’ll see a much more natural-language, Google-like search experience. 
  • New Metadata: This is useful in building faceted navigation

Search for products in less than 100 lines of code with the OrderCloud Javascript 

OrderCloud is language agnostic and API-first. This means you can access all of the domain through an Open API specification by using any of our SDKs or by generating your own clients with your preferred development stack. Because of how developer friendly OrderCloud and its developer portal is, developers can quickly and easily search for products. 


OrderCloud makes it fast to get up and running. Today, we’re going to highlight the OrderCloud JavaScript SDK which makes this process even faster. Specifically, we’ll detail how to go from zero to a searchable product in less than 100 lines of code. Before we get to the code though we’ll need to get some things prepared in our organization.

If you haven’t already  – register for your free OrderCloud account. Then, follow along on our “Getting Started” section. Complete all the guides starting with “Welcome to OrderCloud” and through “Establishing API Access”. We will need to be able to log in as an admin user so that our code has the right permissions to be able to complete the rest of the tasks for us.

The code

Now that you’ve set up an organization with an admin user we can use that login and the SDK to process the rest of the operations necessary for a buyer user to browse a product.

If you want to try to run the code yourself just make sure to fill out ADMIN_USERNAME, ADMIN_PASSWORD and CLIENT_ID and then run the code in runkit which is an online code playground for Node.js.

Now that products are visible to your users, the only thing that’s left is to add more products. Take a look at our “Advanced Querying” knowledge base article to get a better understanding of exactly the powerful filtering and searching that can be accomplished with the OrderCloud API.

Read more about the OrderCloud platform and architecture in the Feature Guide.

New call-to-action