Skip to main content
Tasks are executed after the job is triggered and are the main building blocks of a job. You can string together as many tasks as you want.

Tasks

All tasks are using Shopify’s REST Resources and can be used with the same general pattern:
string
required
Should be a stable and unique cache key inside the run(). See resumability for more information.
object
Resource-specific parameters.

all()

Fetch all resources of a given type.
Returns
array
required
An array of Shopify resources.
PageInfo
The PageInfo object. Will be undefined if there are no further pages.

count()

Fetch the number of resources of a given type.
Returns
number
required
The number of resources.

find()

Fetch a single resource by its ID.
Returns A Promise that resolves to the Shopify resource.

save()

Create or update a resource of a given type. The resource will be created if no ID is specified.
Returns A Promise that resolves to the Shopify resource.

delete()

Delete an existing resource.
Returns A Promise that resolves to undefined when the resource has been deleted. Throws an error otherwise.

Resources

This is a list of REST Resources that can be used directly as Tasks. They all implement the same methods described above. For resources with non-standard methods, you will have to use the raw Shopify API Client instead - please see the end of this page for further instructions.

Example usage

In this example we’ll create some products in response to a customer sign-up, count them all before and after, and do a few other things too.

Using the underlying Shopify API Client

You can access the Shopify API Client instance by using the runTask method on the integration: