Getting to know the parts of the Store Builder Library
Initializing the Store Builder Libarary
The first step to using the Store Builder Library is to initialize the script. Initializing the script is just including the library script on the page. At a minimum it will look similar to the following.
Breaking down the above script there are 4 main parts.
- id – This is the HTML id of the script.
- src – This is the version of the Store Builder Library.
- data-storefront – This is the FastSpring storefront that the Store Builder Library will be working with. Note: The Store Builder Library works with both Web Storefronts and Popup Storefronts.
Extending the Store Builder Library Script
To add more functionality you can add more settings to the Store Builder Library script. These settings are as follows:
- data-debug – This is a flag on the script that turns on logging of the Store Builder Library in the browser console.
- data-access-key – This is a key that must be included in the script if you are going to be making secure calls to the Store Builder Library. Learn more about secure calls here.
- data-continuous – This is a flag on the script that defines if the visitor’s session should be persisted after the script is reloaded.
Directives are markers on a DOM element that allow interaction with the Store Builder Library through HTML. There are three types of directives within the Store Builder Library.
- Product Level Directives – These retrieve information about a single product. Learn more about Product Level Directives here.
- Order Level Directives – These retrieve information about the current order session. Learn more about Order Level Directives here.
- Actions – These allow you to initiate a behavior against the Store Builder Library . Learn more about Actions here.
Using the Store Builder Library
Putting these piece can seem like quite an undertaking but it can be a very simple implementation that provides a good amount of features with very little actual coding up to a full featured cart . We have provided a number of examples of using the Store Builder Library in a simple manner like simply adding a buy button to a page or a more advanced example like a full featured shopping cart.