Skip to main content

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

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.


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:

An overview of the requests associated with a function that has network access
  1. The fetch function target defines an HTTP request based on the existing function input query.

  2. The outcome of FunctionFetchResult conveys an HttpRequest to be executed.

  3. Shopify schedules the request with optimizations.

    Read more about network request caching in the Performance page.

  4. Shopify executes network calls to the external service.

  5. The run function target contains the main logic and has access to the HTTP response through the input query.

  6. 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.


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.



Was this page helpful?