About network access for Shopify Functions
Network access for Shopify Functions allows you to configure HTTP requests for your functions to use data from an external service as an input to your function logic. It's available primarily for merchants on Shopify for enterprises.
This guide introduces how network access for Shopify Functions works and provides examples.
Anchor to Availability of network access for functionsAvailability of network access for functions
Function | Availability |
---|---|
Cart and Checkout Validation | Shopify for enterprises with custom apps |
Local Pickup Delivery Option Generator | Shopify for enterprises with custom apps (Early access) |
Pickup Point Delivery Option Generator | Shopify Plus with custom apps (Early access) |
Discount Functions | Shopify for enterprises with custom apps |
Network access for functions needs to be enabled by Shopify, as it's currently not available on development stores or in a developer preview. Contact Support for more information about the available Shopify Functions that support network access.
Anchor to How it worksHow it works
Network access for Shopify Functions enables you to define your HTTP request using the fetch target of the function. When your function is executed, Shopify performs the HTTP request and includes the response in the input of the run target.
The following diagram shows the different requests that occur with a function that has network access:

-
The
fetch
function target defines an HTTP request based on the existing function input query. -
The outcome of
FunctionFetchResult
conveys anHttpRequest
to be executed. -
Shopify schedules the request with optimizations.
Read more about network request caching in the Performance page.
-
Shopify executes network calls to the external service.
-
The
run
function target contains the main logic and has access to the HTTP response through the input query. -
The outcome of
FunctionRunResult
conveys the function’s final output.
Anchor to Alternatives to network accessAlternatives to network access
Instead of fetching data with an external network call, consider retrieving the data from a metafield in your functions. Most objects support metafields, including products, locations, and customers.
Fetching data from metafields during checkout is more efficient as it doesn't involve an external network call. This lets you to depend on Shopify for the uptime, scalability, and durability of the data storage.
Use the GraphQL Admin or Storefront APIs to write metafields on the store before a buyer reaches checkout.
Anchor to API restrictionsAPI restrictions
Network access for Shopify Functions is subject to the following API restrictions:
-
GraphQL Storefront API types are supported only when used in conjunction with the Storefront API
@defer
directive. -
Online store cart Ajax API endpoints aren't supported.
If you call an unsupported API endpoint, then the function still executes locally, but no actual network request is sent. Instead, the function run target receives a network response with the status
502 - Not supported
.
Anchor to Developer tools and resourcesDeveloper tools and resources
Explore the following developer tools and resources to learn more about network access for Shopify Functions.
Learn how to create and handle a network request.
Consult the network access GraphQL schema reference for Functions.
Learn how how to optimize your app with timeouts, caches and error management.
Anchor to Next stepsNext steps
- Learn how to use network access.
- Learn how to use network access with Discount Functions.