---
title: About Shopify Functions
description: >-
  Learn about how Shopify Functions work and the benefits of using Shopify
  Functions.
source_url:
  html: 'https://shopify.dev/docs/apps/build/functions'
  md: 'https://shopify.dev/docs/apps/build/functions.md'
---

# About Shopify Functions

**Functions availability:**

* Stores on any plan can use public apps that are distributed through the Shopify App Store and contain functions. Only stores on a [Shopify Plus plan](https://help.shopify.com/manual/intro-to-shopify/pricing-plans/plans-features/shopify-plus-plan) can use [custom apps](https://help.shopify.com/manual/apps/app-types/custom-apps) that contain [Shopify Function APIs](https://shopify.dev/docs/api/functions).
* Some Shopify Functions capabilities are available only to stores on a [Shopify Plus plan](https://help.shopify.com/manual/intro-to-shopify/pricing-plans/plans-features/shopify-plus-plan). See [Shopify Function APIs](https://shopify.dev/docs/api/functions#availability-of-shopify-functions) for details.

Shopify Functions allow developers to customize the backend logic of Shopify. This guide introduces how Shopify Functions work and the benefits of using Shopify Functions.

***

## How Shopify Functions work

Function [Targets](https://shopify.dev/docs/apps/build/app-extensions/configure-app-extensions#targets) inject code into the backend logic of Shopify. The following diagram shows how Shopify invokes a function which has been configured for a target:

![A diagram showing how Shopify invokes a function which has been configured for a target.](https://shopify.dev/assets/assets/images/api/functions/extension-targets-C0IXZY73.png)

* **Function input:** The [function input](https://shopify.dev/docs/api/functions/latest#input) is a JSON object which is the result of a GraphQL input query you define. Input queries allow you to select the specific data you need for your function, such as cart line product data or metafields.

* **Function logic:** The [function logic](https://shopify.dev/docs/api/functions/latest#function) is written in any language that can compile a WebAssembly module which meets [function requirements](https://shopify.dev/docs/apps/build/functions/programming-languages/webassembly-for-functions). Function templates and client libraries are available for [Rust](https://shopify.dev/docs/apps/build/functions/programming-languages/rust-for-functions) and [JavaScript](https://shopify.dev/docs/apps/build/functions/programming-languages/javascript-for-functions).

  **Caution:**

  Shopify strongly recommends [Rust](https://shopify.dev/docs/apps/build/functions/programming-languages/rust-for-functions) as the most performant language choice to avoid your function failing with large carts.

* **Function output:** The [function output](https://shopify.dev/docs/api/functions/latest#output) is a JSON document that describes the operations you'd like Shopify to carry out.

  GraphQL schemas provided by Shopify specify the targets, available inputs, and expected outputs for a [Functions API](https://shopify.dev/docs/api/functions).

***

## Lifecycle of a Shopify Function

The following diagram shows an example lifecycle of a Shopify Function:

* **App developers** create and deploy apps that contain functions.

* **Merchants** install the app on their Shopify store and configure the function. An API call is made with the function configuration.

* **Customers** interact with a Shopify store and **Shopify** executes the function.

  For example, an app developer might create and deploy an app with a function that defines a new discount type. The merchant can then install the app on their Shopify store and create a new discount from a discount type provided by the app. Shopify executes the function to calculate the discount when a customer adds a product to their cart.

  Shopify Functions are never invoked directly by URL or otherwise. Shopify invokes them as-needed within the customer journey.

![A diagram showing the creating and deploying phases in Shopify Functions](https://shopify.dev/assets/assets/images/api/functions/create-test-deploy-B8EIsTvz.png)

***

## Getting started

Learn how to use Shopify Functions by following one of our use case tutorials:

[Build a discount function\
\
](https://shopify.dev/docs/apps/build/discounts/build-discount-function)

[Use Shopify Functions to create a new discount type for users.](https://shopify.dev/docs/apps/build/discounts/build-discount-function)

[Create a payments function\
\
](https://shopify.dev/docs/apps/build/checkout/payments/create-payments-function)

[Use Shopify Functions to hide a payment option offered to customers at checkout.](https://shopify.dev/docs/apps/build/checkout/payments/create-payments-function)

[Build a delivery options function\
\
](https://shopify.dev/docs/apps/build/checkout/delivery-shipping/delivery-options/build-function)

[Use Shopify Functions to rename a delivery option offered to customers at checkout.](https://shopify.dev/docs/apps/build/checkout/delivery-shipping/delivery-options/build-function)

[Create a server-side validation function\
\
](https://shopify.dev/docs/apps/build/checkout/cart-checkout-validation/create-server-side-validation-function)

[Use Shopify Functions to block progress on a checkout when the cart line quantities exceed a limit.](https://shopify.dev/docs/apps/build/checkout/cart-checkout-validation/create-server-side-validation-function)

[Build a location rule function\
\
](https://shopify.dev/docs/apps/build/orders-fulfillment/order-routing-apps/location-rules/build-location-rule-function)

[Use Shopify Functions to choose a different order location during checkout.](https://shopify.dev/docs/apps/build/orders-fulfillment/order-routing-apps/location-rules/build-location-rule-function)

[Add a customized bundle function\
\
](https://shopify.dev/docs/apps/build/product-merchandising/bundles/add-customized-bundle-function)

[Use Shopify Functions to group products together and sell them as a single unit.](https://shopify.dev/docs/apps/build/product-merchandising/bundles/add-customized-bundle-function)

[Build a fulfillment constraints function\
\
](https://shopify.dev/docs/apps/build/orders-fulfillment/order-routing-apps/build-fulfillment-constraints-function)

[Use Shopify Functions to customize fulfillment and delivery strategies.](https://shopify.dev/docs/apps/build/orders-fulfillment/order-routing-apps/build-fulfillment-constraints-function)

[Build a local pickup options function\
\
](https://shopify.dev/docs/apps/build/orders-fulfillment/order-routing-apps/build-local-pickup-options-function)

[Use Shopify Functions to generate local pickup delivery options at checkout.](https://shopify.dev/docs/apps/build/orders-fulfillment/order-routing-apps/build-local-pickup-options-function)

[Create a local pickup charges function\
\
](https://shopify.dev/docs/apps/build/checkout/delivery-shipping/delivery-methods/create-local-pickup-charges-function)

[Use Shopify Functions to create local pickup charges at checkout.](https://shopify.dev/docs/apps/build/checkout/delivery-shipping/delivery-methods/create-local-pickup-charges-function)

[Generate a pickup points function\
\
](https://shopify.dev/docs/apps/build/checkout/delivery-shipping/delivery-methods/generate-pickup-points)

[Use Shopify Functions to generate pickup point delivery options at checkout.](https://shopify.dev/docs/apps/build/checkout/delivery-shipping/delivery-methods/generate-pickup-points)

***

## Developer tools and resources

Explore the developer tools and resources available for Shopify Functions.

[Shopify Function APIs reference\
\
](https://shopify.dev/docs/api/functions)

[Learn about the available APIs for Shopify Functions.](https://shopify.dev/docs/api/functions)

[Language support\
\
](https://shopify.dev/docs/apps/build/functions/programming-languages)

[Learn about the language support and tooling that are available in Shopify Functions.](https://shopify.dev/docs/apps/build/functions/programming-languages)

***

## Deleting functions

To delete a Shopify Function, you need to remove the relevant files from your app's `/extensions` directory, and then redeploy your app. [Learn more about removing a Shopify Function](https://shopify.dev/docs/apps/build/app-extensions/remove-app-extension#remove-a-cli-managed-app-extension).

When you delete a function, the following behavior occurs:

* The function, including all associated [function owners](https://shopify.dev/docs/apps/build/functions/input-queries/metafields-for-input-queries#how-it-works), is permanently deleted.
* The function no longer runs, and becomes inaccessible to any Shopify stores that have your app installed.

***

## Next steps

* Learn about how data is [input to and output from Shopify Functions](https://shopify.dev/docs/api/functions/latest#function-anatomy).
* Explore [the references for each Function API](https://shopify.dev/docs/api/functions).

***
