JavaScript API
Instead of using templates, you can grab the data yourself and do whatever you want with it.
Relatable.ready( callback )
- callback function
In an effort to render content as quickly as possible, we're loading the Relatable API asynchronously. That means you must wrap your calls with this function. This will guarantee the script has been loaded when you run your JavaScript.
Relatable.get( params, callback )
- params object
An object with the following keys and values:- query string
The association type in object notation. This determines the kind of resource you have, and the kind of resource you want to retrieve. For example, you might want to show a list of related collections for an article, which would be "article.collections".
- id string/number
A comma separated list of IDs for the base resource. The IDs should always be that of the first half of the query. For example, if your query was "collection.products", you'd want to pass in the IDs of the desired products.
- fields string
A comma separated list of fields to include for the target.Useful for keeping response sizes as small as possible. If left blank, all fields will be returned.
- query string
- callback( response ) function
A callback function to be called once the data is returned. Note that unless specific fields are requested, we'll return the entire resource's attributes that come back from Shopify's API.