This Function API is available only in the Discounts Allocator developer preview.
The Discounts Allocator Function will be available only to [Shopify Plus](https://www.shopify.com/plus) merchants.
Building a Discounts Allocator Function allows for greater customization in defining discount strategies, like implementing custom logic to distribute discounts across line items in an order.
## What you'll learn
In this tutorial, you'll create a Discounts Allocator Function that uses metafields to help define its custom allocation logic.
The first metafield is applied at the order level. It sets a cap on the discount, ensuring that a 50% discount won't exceed a specified dollar amount.
The second metafield is applied at the shop level. It sets a maximum discounted amount for a cart.