Introduced in 2022, Shopify Functions offer a new technological approach to customizing the business logics of a Shopify store, by allowing developers to inject custom code into the Shopify backend.
With Shopify Functions, developers can create a wide variety of rules applied to the cart page or in the checkout tunnel: payment validation conditions, product bundles, specific discounts (e.g. volume discounts), custom delivery rules (e.g. to hide or reorder options),...
Shopify Functions are deployed as public or custom Apps. If the developer chooses to make a public App, it may be marketed in the App Store and it will be available to all Shopify merchants. If it's a custom App, then it can only be installed on Shopify Plus stores.
Concretely, Functions are WebAssembly module that contains custom business logic. Functions can be written in any language that supports WebAssembly. And to make it even easier to create Functions, it will soon be possible to write them in JavaScript!
The different Shopify Functions APIs currently available are:
- Delivery Customization API : rename, rearrange and sort the delivery options available to clients in the checkout tunnel.
- Order Discount API : create a discount that applies in the cart to all products of an order.
- Product Discount API : create a discount that applies to a particular product in the cart.
- Payment Customization API : rename, rearrange and sort the payment options available to clients.
- Cart and Checkout Validation API : apply a specific rule to validate a cart and a payment.
- Order Routing Location Rule API : decide for each item which inventory location to use for fulfillment.
- Shipping Discount API : create a discount that applies to one or more shipping rates in the checkout tunnel.
- Cart Transform API : expand or condense the display of items (products, product bundles) in the cart.
Shopify maintains a Shopify Functions technical documentation, including the exact availability of each API (some are currently in "developer preview" or "early access").
To discuss Shopify Functions and their different use cases, feel free to contact us.