Skip to main content

Anchor to Discounts Allocator Function APIDiscounts Allocator Function API

Beta

This API is available only in developer preview.

Allocating discounts determines how to apply price reductions to specific products or orders. For example, applying a maximum discount of $500.00 for each cart. To provide custom logic that determines how discounts should be calculated in a cart, you can only use the Discounts Allocator API.

Shopify Functions enable you to customize Shopify's backend logic. The Discounts Allocator API integrates this logic into the checkout flow.

Use the API to implement custom logic that distributes discounts across items in a cart, with associated data such as buyer identity, discount codes, and metafields.

Note

You can install a maximum of one Discount Allocator Function on each store. Only custom apps installed on developer preview stores can use this API.

Merchants must be enrolled in the Partners program to deploy their own custom apps and location rules.

  • Set a maximum discount amount that can be applied to a cart.
  • Set a limit on the number of times that a specific discount can be applied to a cart, or the number of discounts that can be applied to an order.
  • Allow more than one discount to apply to the same item in a cart.
  • Apply discounts to line items proportionally, where each item in the cart receives an equal percentage of the total discount.
Was this section helpful?

Scaffolding the Function using Shopify CLI will automatically configure your TOML file. You can alter the default configuration to customize the way your Function operates.

Was this section helpful?

A target is an identifier in shopify.extension.toml that specifies where you're injecting code into Shopify Function APIs, or other parts of the Shopify platform. Each target is composed of three to four namespaces. The name begins with a broad Shopify context and ends with the behavior of the extensible element.


purchase.discounts-allocator.run

The run target distributes discounts across items in a cart, either using Shopify data or hardcoded values. The target returns a list of discounts applied to each item in a cart.

For example, you might use this to apply discounts to an order in a multiplicative manner. For instance, a 10% discount followed by a 20% discount results in a total discount of 28%.

OBJECT

The Input object is the complete GraphQL schema that your Function can query as input to customize how discounts should be calculated in a cart. Your Function receives only the fields that you request in the input query. To optimize performance, we highly recommend that you request only the fields that your Function requires.

non-null

The cart where the Function is running. A cart contains the merchandise that a customer intends to purchase and information about the customer, such as the customer's email address and phone number.

The custom attributes associated with a cart to store additional information. Cart attributes allow you to collect specific information from customers on the Cart page, such as order notes, gift wrapping requests, or custom product details. Attributes are stored as key-value pairs.

Arguments

The key of the cart attribute to retrieve. For example, "gift_wrapping".


Fields

non-null

The key or name of the attribute. For example, "customer_first_order".

The value of the attribute. For example, "true".

Information about the customer that's interacting with the cart. It includes details such as the customer's email and phone number, and the total amount of money the customer has spent in the store. This information helps personalize the checkout experience and ensures that accurate pricing and delivery options are displayed to customers.

The customer that's interacting with the cart. A customer is a buyer who has an account with the store.

non-null

The total amount that the customer has spent on orders. The amount is converted from the shop's currency to the currency of the cart using a market rate.

non-null

A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.

non-null

The three-letter currency code that represents a world currency used in a store. Currency codes include standard standard ISO 4217 codes, legacy codes, and non-standard codes. For example, USD.

AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, BYN, BZD, CAD, CDF, CHF, CLP, CNY, COP, CRC, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, INR, IQD, IRR, ISK, JEP, JMD, JOD, JPY, KES, KGS, KHR, KID, KMF, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LTL, LVL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRU, MUR, MVR, MWK, MXN, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK, SGD, SHP, SLL, SOS, SRD, SSP, STN, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
non-null

The full name of the customer, based on the values for firstName and lastName. If firstName and lastName aren't specified, then the value is the customer's email address. If the email address isn't specified, then the value is the customer's phone number.

The customer's email address.

The customer's first name.

non-null

Whether the customer is associated with any of the specified tags. The customer must have at least one tag from the list to return true.

non-null

Whether the customer is associated with the specified tags. The customer must have all of the tags in the list to return true.

Arguments

required

A comma-separated list of searchable keywords that are associated with the customer. For example, "VIP, Gold" returns customers with both the VIP and Gold tags.


Fields

non-null

Whether the Shopify resource has the tag.

non-null

A searchable keyword that's associated with a Shopify resource, such as a product or customer. For example, a merchant might apply the sports and summer tags to products that are associated with sportswear for summer.

non-null

A globally-unique ID for the customer.

The customer's last name.

A custom field that stores additional information about a Shopify resource, such as products, orders, and many more. Using metafields with Shopify Functions enables you to customize the checkout experience.

Arguments

A category that organizes a group of metafields. Namespaces are used to prevent naming conflicts between different apps or different parts of the same app. If omitted, then the app-reserved namespace is used.

required

The unique identifier for the metafield within its namespace. A metafield is composed of a namespace and a key, in the format namespace.key.


Fields

non-null

The data that's stored in the metafield, using JSON format.

non-null

The type of data that the metafield stores in the value field.

non-null

The data that's stored in the metafield. The data is always stored as a string, regardless of the metafield's type.

non-null

The total number of orders that the customer has made at the store.

The email address of the customer that's interacting with the cart.

non-null

Whether the customer is authenticated through their customer account. If the customer is authenticated, then the customer field returns the customer's information. If the customer isn't authenticated, then the customer field returns null.

The phone number of the customer that's interacting with the cart.

The company of a B2B customer that's interacting with the cart. Used to manage and track purchases made by businesses rather than individual customers.

non-null

The company associated to the order or draft order.

non-null

The date and time (ISO 8601 format) at which the company was created in Shopify.

A unique externally-supplied ID for the company.

non-null

The ID of the company.

A custom field that stores additional information about a Shopify resource, such as products, orders, and many more. Using metafields with Shopify Functions enables you to customize the checkout experience.

Arguments

A category that organizes a group of metafields. Namespaces are used to prevent naming conflicts between different apps or different parts of the same app. If omitted, then the app-reserved namespace is used.

required

The unique identifier for the metafield within its namespace. A metafield is composed of a namespace and a key, in the format namespace.key.


Fields

non-null

The data that's stored in the metafield, using JSON format.

non-null

The type of data that the metafield stores in the value field.

non-null

The data that's stored in the metafield. The data is always stored as a string, regardless of the metafield's type.

non-null

The name of the company.

non-null

The date and time (ISO 8601 format) at which the company was last modified.

The company contact associated to the order or draft order.

non-null

The date and time (ISO 8601 format) at which the company contact was created in Shopify.

non-null

The ID of the company.

The company contact's locale (language).

The company contact's job title.

non-null

The date and time (ISO 8601 format) at which the company contact was last modified.

non-null

The company location associated to the order or draft order.

non-null

The date and time (ISO 8601 format) at which the company location was created in Shopify.

A unique externally-supplied ID for the company.

non-null

The ID of the company.

The preferred locale of the company location.

A custom field that stores additional information about a Shopify resource, such as products, orders, and many more. Using metafields with Shopify Functions enables you to customize the checkout experience.

Arguments

A category that organizes a group of metafields. Namespaces are used to prevent naming conflicts between different apps or different parts of the same app. If omitted, then the app-reserved namespace is used.

required

The unique identifier for the metafield within its namespace. A metafield is composed of a namespace and a key, in the format namespace.key.


Fields

non-null

The data that's stored in the metafield, using JSON format.

non-null

The type of data that the metafield stores in the value field.

non-null

The data that's stored in the metafield. The data is always stored as a string, regardless of the metafield's type.

non-null

The name of the company location.

non-null

The date and time (ISO 8601 format) at which the company location was last modified.

non-null

A breakdown of the costs that the customer will pay at checkout. It includes the total amount, the subtotal before taxes and duties, the tax amount, and duty charges.

non-null

The amount for the customer to pay at checkout, excluding taxes and discounts.

non-null

A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.

non-null

The three-letter currency code that represents a world currency used in a store. Currency codes include standard standard ISO 4217 codes, legacy codes, and non-standard codes. For example, USD.

AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, BYN, BZD, CAD, CDF, CHF, CLP, CNY, COP, CRC, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, INR, IQD, IRR, ISK, JEP, JMD, JOD, JPY, KES, KGS, KHR, KID, KMF, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LTL, LVL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRU, MUR, MVR, MWK, MXN, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK, SGD, SHP, SLL, SOS, SRD, SSP, STN, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
non-null

The total amount for the customer to pay at checkout.

non-null

A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.

non-null

The three-letter currency code that represents a world currency used in a store. Currency codes include standard standard ISO 4217 codes, legacy codes, and non-standard codes. For example, USD.

AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, BYN, BZD, CAD, CDF, CHF, CLP, CNY, COP, CRC, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, INR, IQD, IRR, ISK, JEP, JMD, JOD, JPY, KES, KGS, KHR, KID, KMF, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LTL, LVL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRU, MUR, MVR, MWK, MXN, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK, SGD, SHP, SLL, SOS, SRD, SSP, STN, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF

The duty charges for a customer to pay at checkout.

non-null

A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.

non-null

The three-letter currency code that represents a world currency used in a store. Currency codes include standard standard ISO 4217 codes, legacy codes, and non-standard codes. For example, USD.

AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, BYN, BZD, CAD, CDF, CHF, CLP, CNY, COP, CRC, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, INR, IQD, IRR, ISK, JEP, JMD, JOD, JPY, KES, KGS, KHR, KID, KMF, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LTL, LVL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRU, MUR, MVR, MWK, MXN, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK, SGD, SHP, SLL, SOS, SRD, SSP, STN, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF

The total tax amount for the customer to pay at checkout.

non-null

A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.

non-null

The three-letter currency code that represents a world currency used in a store. Currency codes include standard standard ISO 4217 codes, legacy codes, and non-standard codes. For example, USD.

AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, BYN, BZD, CAD, CDF, CHF, CLP, CNY, COP, CRC, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, INR, IQD, IRR, ISK, JEP, JMD, JOD, JPY, KES, KGS, KHR, KID, KMF, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LTL, LVL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRU, MUR, MVR, MWK, MXN, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK, SGD, SHP, SLL, SOS, SRD, SSP, STN, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
non-null

The items in a cart that are eligible for fulfillment and can be delivered to the customer.

The custom attributes associated with a cart to store additional information. Cart attributes allow you to collect specific information from customers on the Cart page, such as order notes, gift wrapping requests, or custom product details. Attributes are stored as key-value pairs.

Cart line attributes are equivalent to the line_item object in Liquid.

Arguments

The key of the cart attribute to retrieve. For example, "gift_wrapping".


Fields

non-null

The key or name of the attribute. For example, "customer_first_order".

The value of the attribute. For example, "true".

non-null

The ID of the cart line.

non-null

The item that the customer intends to purchase.

OBJECT

A custom product represents a product that doesn't map to Shopify's standard product categories. For example, you can use a custom product to manage gift cards, shipping requirements, localized product information, or weight measurements and conversions.

non-null

Whether the merchandise is a gift card.

non-null

Whether the item needs to be shipped to the customer. For example, a digital gift card doesn't need to be shipped, but a t-shirt does need to be shipped.

non-null

The localized name for the product that displays to customers. The title is used to construct the product's handle, which is a unique, human-readable string of the product's title. For example, if a product is titled "Black Sunglasses", then the handle is black-sunglasses.

The product variant's weight, in the system of measurement set in the weightUnit field.

non-null

The unit of measurement for weight.

GRAMS, KILOGRAMS, OUNCES, POUNDS
OBJECT

A specific version of a product that comes in more than one option, such as size or color. For example, if a merchant sells t-shirts with options for size and color, then a small, blue t-shirt would be one product variant and a large, blue t-shirt would be another.

non-null

A globally-unique ID for the product variant.

A custom field that stores additional information about a Shopify resource, such as products, orders, and many more. Using metafields with Shopify Functions enables you to customize the checkout experience.

Arguments

A category that organizes a group of metafields. Namespaces are used to prevent naming conflicts between different apps or different parts of the same app. If omitted, then the app-reserved namespace is used.

required

The unique identifier for the metafield within its namespace. A metafield is composed of a namespace and a key, in the format namespace.key.


Fields

non-null

The data that's stored in the metafield, using JSON format.

non-null

The type of data that the metafield stores in the value field.

non-null

The data that's stored in the metafield. The data is always stored as a string, regardless of the metafield's type.

non-null

The product associated with the product variant. For example, if a merchant sells t-shirts with options for size and color, then a small, blue t-shirt would be one product variant and a large, blue t-shirt would be another. The product associated with the product variant would be the t-shirt itself.

non-null

A unique, human-readable string of the product's title. A handle can contain letters, hyphens (-), and numbers, but not spaces. The handle is used in the online store URL for the product. For example, if a product is titled "Black Sunglasses", then the handle is black-sunglasses.

non-null

Whether the product is associated with any of the specified tags. The product must have at least one tag from the list to return true.

non-null

Whether the product is associated with the specified tags. The product must have all of the tags in the list to return true.

Arguments

required

A comma-separated list of searchable keywords that are associated with the product. For example, "sports, summer" returns products with both the sports and summer tags.


Fields

non-null

Whether the Shopify resource has the tag.

non-null

A searchable keyword that's associated with a Shopify resource, such as a product or customer. For example, a merchant might apply the sports and summer tags to products that are associated with sportswear for summer.

non-null

A globally-unique ID for the product.

non-null

Whether the product is in any of the specified collections. The product must be in at least one collection from the list to return true.

A collection is a group of products that can be displayed in online stores and other sales channels in categories, which makes it easy for customers to find them. For example, an athletics store might create different collections for running attire and accessories.

non-null

Whether the product is in the specified collections. The product must be in all of the collections in the list to return true.

A collection is a group of products that can be displayed in online stores and other sales channels in categories, which makes it easy for customers to find them. For example, an athletics store might create different collections for running attire and accessories.

Arguments

required

A comma-separated list of globally-unique collection IDs that are associated with the product. For example, gid://shopify/Collection/123, gid://shopify/Collection/456.


Fields

non-null

A globally-unique ID for the collection.

non-null

Whether the product is in the specified collection.

non-null

Whether the product is a gift card.

A custom field that stores additional information about a Shopify resource, such as products, orders, and many more. Using metafields with Shopify Functions enables you to customize the checkout experience.

Arguments

A category that organizes a group of metafields. Namespaces are used to prevent naming conflicts between different apps or different parts of the same app. If omitted, then the app-reserved namespace is used.

required

The unique identifier for the metafield within its namespace. A metafield is composed of a namespace and a key, in the format namespace.key.


Fields

non-null

The data that's stored in the metafield, using JSON format.

non-null

The type of data that the metafield stores in the value field.

non-null

The data that's stored in the metafield. The data is always stored as a string, regardless of the metafield's type.

A custom category for a product. Product types allow merchants to define categories other than the ones available in Shopify's standard product categories.

non-null

The localized name for the product that displays to customers. The title is used to construct the product's handle, which is a unique, human-readable string of the product's title. For example, if a product is titled "Black Sunglasses", then the handle is black-sunglasses.

The name of the product's vendor.

non-nullDeprecated
non-null

Whether the item needs to be shipped to the customer. For example, a digital gift card doesn't need to be shipped, but a t-shirt does need to be shipped.

A case-sensitive identifier for the product variant in the merchant's store. For example, "BBC-1". A product variant must have a SKU to be connected to a fulfillment service.

The localized name for the product variant that displays to customers.

The product variant's weight, in the system of measurement set in the weightUnit field.

non-null

The unit of measurement for weight.

GRAMS, KILOGRAMS, OUNCES, POUNDS
non-null

The quantity of the item that the customer intends to purchase.

non-null

A collection of items that are grouped by shared delivery characteristics. Delivery groups streamline fulfillment by organizing items that can be shipped together, based on the customer's shipping address. For example, if a customer orders a t-shirt and a pair of shoes that can be shipped together, then the items are included in the same delivery group.

In the Order Discount and Product Discount legacy APIs, the cart.deliveryGroups input is always an empty array. This means you can't access delivery groups when creating Order Discount or Product Discount Functions. If you need to apply discounts to shipping costs, then use the Discount Function API instead.

non-null

Information about items in a cart that a customer intends to purchase. A cart line is an entry in the customer's cart that represents a single unit of a product variant. For example, if a customer adds two different sizes of the same t-shirt to their cart, then each size is represented as a separate cart line.

The custom attributes associated with a cart to store additional information. Cart attributes allow you to collect specific information from customers on the Cart page, such as order notes, gift wrapping requests, or custom product details. Attributes are stored as key-value pairs.

Cart line attributes are equivalent to the line_item object in Liquid.

Arguments

The key of the cart attribute to retrieve. For example, "gift_wrapping".


Fields

non-null

The key or name of the attribute. For example, "customer_first_order".

The value of the attribute. For example, "true".

non-null

The cost of an item in a cart that the customer intends to purchase. Cart lines are entries in the customer's cart that represent a single unit of a product variant. For example, if a customer adds two different sizes of the same t-shirt to their cart, then each size is represented as a separate cart line.

non-null

The cost of a single unit. For example, if a customer purchases three units of a product that are priced at $10 each, then the amountPerQuantity is $10.

non-null

A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.

non-null

The three-letter currency code that represents a world currency used in a store. Currency codes include standard standard ISO 4217 codes, legacy codes, and non-standard codes. For example, USD.

AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, BYN, BZD, CAD, CDF, CHF, CLP, CNY, COP, CRC, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, INR, IQD, IRR, ISK, JEP, JMD, JOD, JPY, KES, KGS, KHR, KID, KMF, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LTL, LVL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRU, MUR, MVR, MWK, MXN, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK, SGD, SHP, SLL, SOS, SRD, SSP, STN, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
Anchor to compareAtAmountPerQuantitycompareAtAmountPerQuantity

The cost of a single unit before any discounts are applied. This field is used to calculate and display savings for customers. For example, if a product's compareAtAmountPerQuantity is $25 and its current price is $20, then the customer sees a $5 discount. This value can change based on the buyer's identity and is null when the value is hidden from buyers.

non-null

A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.

non-null

The three-letter currency code that represents a world currency used in a store. Currency codes include standard standard ISO 4217 codes, legacy codes, and non-standard codes. For example, USD.

AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, BYN, BZD, CAD, CDF, CHF, CLP, CNY, COP, CRC, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, INR, IQD, IRR, ISK, JEP, JMD, JOD, JPY, KES, KGS, KHR, KID, KMF, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LTL, LVL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRU, MUR, MVR, MWK, MXN, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK, SGD, SHP, SLL, SOS, SRD, SSP, STN, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
non-null

The cost of items in the cart before applying any discounts to certain items. This amount serves as the starting point for calculating any potential savings customers might receive through promotions or discounts.

non-null

A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.

non-null

The three-letter currency code that represents a world currency used in a store. Currency codes include standard standard ISO 4217 codes, legacy codes, and non-standard codes. For example, USD.

AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, BYN, BZD, CAD, CDF, CHF, CLP, CNY, COP, CRC, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, INR, IQD, IRR, ISK, JEP, JMD, JOD, JPY, KES, KGS, KHR, KID, KMF, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LTL, LVL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRU, MUR, MVR, MWK, MXN, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK, SGD, SHP, SLL, SOS, SRD, SSP, STN, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
non-null

The total cost of items in a cart.

non-null

A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.

non-null

The three-letter currency code that represents a world currency used in a store. Currency codes include standard standard ISO 4217 codes, legacy codes, and non-standard codes. For example, USD.

AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, BYN, BZD, CAD, CDF, CHF, CLP, CNY, COP, CRC, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, INR, IQD, IRR, ISK, JEP, JMD, JOD, JPY, KES, KGS, KHR, KID, KMF, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LTL, LVL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRU, MUR, MVR, MWK, MXN, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK, SGD, SHP, SLL, SOS, SRD, SSP, STN, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
non-null

The ID of the cart line.

non-null

The item that the customer intends to purchase.

OBJECT

A custom product represents a product that doesn't map to Shopify's standard product categories. For example, you can use a custom product to manage gift cards, shipping requirements, localized product information, or weight measurements and conversions.

non-null

Whether the merchandise is a gift card.

non-null

Whether the item needs to be shipped to the customer. For example, a digital gift card doesn't need to be shipped, but a t-shirt does need to be shipped.

non-null

The localized name for the product that displays to customers. The title is used to construct the product's handle, which is a unique, human-readable string of the product's title. For example, if a product is titled "Black Sunglasses", then the handle is black-sunglasses.

The product variant's weight, in the system of measurement set in the weightUnit field.

non-null

The unit of measurement for weight.

GRAMS, KILOGRAMS, OUNCES, POUNDS
OBJECT

A specific version of a product that comes in more than one option, such as size or color. For example, if a merchant sells t-shirts with options for size and color, then a small, blue t-shirt would be one product variant and a large, blue t-shirt would be another.

non-null

A globally-unique ID for the product variant.

A custom field that stores additional information about a Shopify resource, such as products, orders, and many more. Using metafields with Shopify Functions enables you to customize the checkout experience.

Arguments

A category that organizes a group of metafields. Namespaces are used to prevent naming conflicts between different apps or different parts of the same app. If omitted, then the app-reserved namespace is used.

required

The unique identifier for the metafield within its namespace. A metafield is composed of a namespace and a key, in the format namespace.key.


Fields

non-null

The data that's stored in the metafield, using JSON format.

non-null

The type of data that the metafield stores in the value field.

non-null

The data that's stored in the metafield. The data is always stored as a string, regardless of the metafield's type.

non-null

The product associated with the product variant. For example, if a merchant sells t-shirts with options for size and color, then a small, blue t-shirt would be one product variant and a large, blue t-shirt would be another. The product associated with the product variant would be the t-shirt itself.

non-null

A unique, human-readable string of the product's title. A handle can contain letters, hyphens (-), and numbers, but not spaces. The handle is used in the online store URL for the product. For example, if a product is titled "Black Sunglasses", then the handle is black-sunglasses.

non-null

Whether the product is associated with any of the specified tags. The product must have at least one tag from the list to return true.

non-null

Whether the product is associated with the specified tags. The product must have all of the tags in the list to return true.

Arguments

required

A comma-separated list of searchable keywords that are associated with the product. For example, "sports, summer" returns products with both the sports and summer tags.


Fields

non-null

Whether the Shopify resource has the tag.

non-null

A searchable keyword that's associated with a Shopify resource, such as a product or customer. For example, a merchant might apply the sports and summer tags to products that are associated with sportswear for summer.

non-null

A globally-unique ID for the product.

non-null

Whether the product is in any of the specified collections. The product must be in at least one collection from the list to return true.

A collection is a group of products that can be displayed in online stores and other sales channels in categories, which makes it easy for customers to find them. For example, an athletics store might create different collections for running attire and accessories.

non-null

Whether the product is in the specified collections. The product must be in all of the collections in the list to return true.

A collection is a group of products that can be displayed in online stores and other sales channels in categories, which makes it easy for customers to find them. For example, an athletics store might create different collections for running attire and accessories.

Arguments

required

A comma-separated list of globally-unique collection IDs that are associated with the product. For example, gid://shopify/Collection/123, gid://shopify/Collection/456.


Fields

non-null

A globally-unique ID for the collection.

non-null

Whether the product is in the specified collection.

non-null

Whether the product is a gift card.

A custom field that stores additional information about a Shopify resource, such as products, orders, and many more. Using metafields with Shopify Functions enables you to customize the checkout experience.

Arguments

A category that organizes a group of metafields. Namespaces are used to prevent naming conflicts between different apps or different parts of the same app. If omitted, then the app-reserved namespace is used.

required

The unique identifier for the metafield within its namespace. A metafield is composed of a namespace and a key, in the format namespace.key.


Fields

non-null

The data that's stored in the metafield, using JSON format.

non-null

The type of data that the metafield stores in the value field.

non-null

The data that's stored in the metafield. The data is always stored as a string, regardless of the metafield's type.

A custom category for a product. Product types allow merchants to define categories other than the ones available in Shopify's standard product categories.

non-null

The localized name for the product that displays to customers. The title is used to construct the product's handle, which is a unique, human-readable string of the product's title. For example, if a product is titled "Black Sunglasses", then the handle is black-sunglasses.

The name of the product's vendor.

non-nullDeprecated
non-null

Whether the item needs to be shipped to the customer. For example, a digital gift card doesn't need to be shipped, but a t-shirt does need to be shipped.

A case-sensitive identifier for the product variant in the merchant's store. For example, "BBC-1". A product variant must have a SKU to be connected to a fulfillment service.

The localized name for the product variant that displays to customers.

The product variant's weight, in the system of measurement set in the weightUnit field.

non-null

The unit of measurement for weight.

GRAMS, KILOGRAMS, OUNCES, POUNDS
non-null

The quantity of the item that the customer intends to purchase.

Anchor to sellingPlanAllocationsellingPlanAllocation

The selling plan associated with the cart line, including information about how a product variant can be sold and purchased.

non-null

A list of price adjustments, with a maximum of two. When there are two, the first price adjustment goes into effect at the time of purchase, while the second one starts after a certain number of orders. A price adjustment represents how a selling plan affects pricing when a variant is purchased with a selling plan. Prices display in the customer's currency if the shop is configured for it.

non-null

The effective price for a single delivery. For example, for a prepaid subscription plan that includes 6 deliveries at the price of $48.00, the per delivery price is $8.00.

non-null

A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.

non-null

The three-letter currency code that represents a world currency used in a store. Currency codes include standard standard ISO 4217 codes, legacy codes, and non-standard codes. For example, USD.

AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, BYN, BZD, CAD, CDF, CHF, CLP, CNY, COP, CRC, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, INR, IQD, IRR, ISK, JEP, JMD, JOD, JPY, KES, KGS, KHR, KID, KMF, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LTL, LVL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRU, MUR, MVR, MWK, MXN, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK, SGD, SHP, SLL, SOS, SRD, SSP, STN, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
non-null

The price of the variant when it's purchased with a selling plan For example, for a prepaid subscription plan that includes 6 deliveries of $10.00 granola, where the customer gets 20% off, the price is 6 x $10.00 x 0.80 = $48.00.

non-null

A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.

non-null

The three-letter currency code that represents a world currency used in a store. Currency codes include standard standard ISO 4217 codes, legacy codes, and non-standard codes. For example, USD.

AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, BYN, BZD, CAD, CDF, CHF, CLP, CNY, COP, CRC, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, INR, IQD, IRR, ISK, JEP, JMD, JOD, JPY, KES, KGS, KHR, KID, KMF, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LTL, LVL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRU, MUR, MVR, MWK, MXN, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK, SGD, SHP, SLL, SOS, SRD, SSP, STN, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
non-null

A representation of how products and variants can be sold and purchased. For example, an individual selling plan could be '6 weeks of prepaid granola, delivered weekly'.

The description of the selling plan.

non-null

A globally-unique identifier.

A custom field that stores additional information about a Shopify resource, such as products, orders, and many more. Using metafields with Shopify Functions enables you to customize the checkout experience.

Arguments

A category that organizes a group of metafields. Namespaces are used to prevent naming conflicts between different apps or different parts of the same app. If omitted, then the app-reserved namespace is used.

required

The unique identifier for the metafield within its namespace. A metafield is composed of a namespace and a key, in the format namespace.key.


Fields

non-null

The data that's stored in the metafield, using JSON format.

non-null

The type of data that the metafield stores in the value field.

non-null

The data that's stored in the metafield. The data is always stored as a string, regardless of the metafield's type.

non-null

The name of the selling plan. For example, '6 weeks of prepaid granola, delivered weekly'.

non-null

Whether purchasing the selling plan will result in multiple deliveries.

The shipping or destination address associated with the delivery group.

The first line of the address. Typically the street address or PO Box number.

The second line of the address. Typically the number of the apartment, suite, or unit.

The name of the city, district, village, or town.

The name of the customer's company or organization.

The two-letter code for the country of the address. For example, US.

AC, AD, AE, AF, AG, AI, AL, AM, AN, AO, AR, AT, AU, AW, AX, AZ, BA, BB, BD, BE, BF, BG, BH, BI, BJ, BL, BM, BN, BO, BQ, BR, BS, BT, BV, BW, BY, BZ, CA, CC, CD, CF, CG, CH, CI, CK, CL, CM, CN, CO, CR, CU, CV, CW, CX, CY, CZ, DE, DJ, DK, DM, DO, DZ, EC, EE, EG, EH, ER, ES, ET, FI, FJ, FK, FO, FR, GA, GB, GD, GE, GF, GG, GH, GI, GL, GM, GN, GP, GQ, GR, GS, GT, GW, GY, HK, HM, HN, HR, HT, HU, ID, IE, IL, IM, IN, IO, IQ, IR, IS, IT, JE, JM, JO, JP, KE, KG, KH, KI, KM, KN, KP, KR, KW, KY, KZ, LA, LB, LC, LI, LK, LR, LS, LT, LU, LV, LY, MA, MC, MD, ME, MF, MG, MK, ML, MM, MN, MO, MQ, MR, MS, MT, MU, MV, MW, MX, MY, MZ, NA, NC, NE, NF, NG, NI, NL, NO, NP, NR, NU, NZ, OM, PA, PE, PF, PG, PH, PK, PL, PM, PN, PS, PT, PY, QA, RE, RO, RS, RU, RW, SA, SB, SC, SD, SE, SG, SH, SI, SJ, SK, SL, SM, SN, SO, SR, SS, ST, SV, SX, SY, SZ, TA, TC, TD, TF, TG, TH, TJ, TK, TL, TM, TN, TO, TR, TT, TV, TW, TZ, UA, UG, UM, US, UY, UZ, VA, VC, VE, VG, VN, VU, WF, WS, XK, YE, YT, ZA, ZM, ZW, ZZ

The first name of the customer.

The last name of the customer.

The approximate latitude of the address.

The approximate longitude of the address.

The full name of the customer, based on firstName and lastName.

A unique phone number for the customer. Formatted using E.164 standard. For example, +16135551111.

The alphanumeric code for the region. For example, ON.

The zip or postal code of the address.

Deprecated
non-null

The delivery options available for the delivery group. Delivery options are the different ways that customers can choose to have their orders shipped. Examples include express shipping or standard shipping.

A unique identifier that represents the delivery option offered to customers. For example, Canada Post Expedited.

non-null

The amount that the customer pays if they select the delivery option.

non-null

A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.

non-null

The three-letter currency code that represents a world currency used in a store. Currency codes include standard standard ISO 4217 codes, legacy codes, and non-standard codes. For example, USD.

AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, BYN, BZD, CAD, CDF, CHF, CLP, CNY, COP, CRC, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, INR, IQD, IRR, ISK, JEP, JMD, JOD, JPY, KES, KGS, KHR, KID, KMF, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LTL, LVL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRU, MUR, MVR, MWK, MXN, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK, SGD, SHP, SLL, SOS, SRD, SSP, STN, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
non-null

The delivery method associated with the delivery option. A delivery method is a way that merchants can fulfill orders from their online stores. Delivery methods include shipping to an address, local pickup, and shipping to a pickup point, all of which are natively supported by Shopify checkout.

LOCAL, NONE, PICK_UP, PICKUP_POINT, RETAIL, SHIPPING

A single-line description of the delivery option, with HTML tags removed.

non-null

A unique, human-readable identifier of the delivery option's title. A handle can contain letters, hyphens (-), and numbers, but not spaces. For example, standard-shipping.

The name of the delivery option that displays to customers. The title is used to construct the delivery option's handle. For example, if a delivery option is titled "Standard Shipping", then the handle is standard-shipping.

non-null

A globally-unique ID for the delivery group.

Anchor to selectedDeliveryOptionselectedDeliveryOption

Information about the delivery option that the customer has selected.

A unique identifier that represents the delivery option offered to customers. For example, Canada Post Expedited.

non-null

The amount that the customer pays if they select the delivery option.

non-null

A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.

non-null

The three-letter currency code that represents a world currency used in a store. Currency codes include standard standard ISO 4217 codes, legacy codes, and non-standard codes. For example, USD.

AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, BYN, BZD, CAD, CDF, CHF, CLP, CNY, COP, CRC, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, INR, IQD, IRR, ISK, JEP, JMD, JOD, JPY, KES, KGS, KHR, KID, KMF, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LTL, LVL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRU, MUR, MVR, MWK, MXN, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK, SGD, SHP, SLL, SOS, SRD, SSP, STN, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
non-null

The delivery method associated with the delivery option. A delivery method is a way that merchants can fulfill orders from their online stores. Delivery methods include shipping to an address, local pickup, and shipping to a pickup point, all of which are natively supported by Shopify checkout.

LOCAL, NONE, PICK_UP, PICKUP_POINT, RETAIL, SHIPPING

A single-line description of the delivery option, with HTML tags removed.

non-null

A unique, human-readable identifier of the delivery option's title. A handle can contain letters, hyphens (-), and numbers, but not spaces. For example, standard-shipping.

The name of the delivery option that displays to customers. The title is used to construct the delivery option's handle. For example, if a delivery option is titled "Standard Shipping", then the handle is standard-shipping.

non-null

The items in a cart that the customer intends to purchase. A cart line is an entry in the customer's cart that represents a single unit of a product variant. For example, if a customer adds two different sizes of the same t-shirt to their cart, then each size is represented as a separate cart line.

The custom attributes associated with a cart to store additional information. Cart attributes allow you to collect specific information from customers on the Cart page, such as order notes, gift wrapping requests, or custom product details. Attributes are stored as key-value pairs.

Cart line attributes are equivalent to the line_item object in Liquid.

Arguments

The key of the cart attribute to retrieve. For example, "gift_wrapping".


Fields

non-null

The key or name of the attribute. For example, "customer_first_order".

The value of the attribute. For example, "true".

non-null

The cost of an item in a cart that the customer intends to purchase. Cart lines are entries in the customer's cart that represent a single unit of a product variant. For example, if a customer adds two different sizes of the same t-shirt to their cart, then each size is represented as a separate cart line.

non-null

The cost of a single unit. For example, if a customer purchases three units of a product that are priced at $10 each, then the amountPerQuantity is $10.

non-null

A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.

non-null

The three-letter currency code that represents a world currency used in a store. Currency codes include standard standard ISO 4217 codes, legacy codes, and non-standard codes. For example, USD.

AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, BYN, BZD, CAD, CDF, CHF, CLP, CNY, COP, CRC, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, INR, IQD, IRR, ISK, JEP, JMD, JOD, JPY, KES, KGS, KHR, KID, KMF, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LTL, LVL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRU, MUR, MVR, MWK, MXN, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK, SGD, SHP, SLL, SOS, SRD, SSP, STN, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
Anchor to compareAtAmountPerQuantitycompareAtAmountPerQuantity

The cost of a single unit before any discounts are applied. This field is used to calculate and display savings for customers. For example, if a product's compareAtAmountPerQuantity is $25 and its current price is $20, then the customer sees a $5 discount. This value can change based on the buyer's identity and is null when the value is hidden from buyers.

non-null

A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.

non-null

The three-letter currency code that represents a world currency used in a store. Currency codes include standard standard ISO 4217 codes, legacy codes, and non-standard codes. For example, USD.

AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, BYN, BZD, CAD, CDF, CHF, CLP, CNY, COP, CRC, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, INR, IQD, IRR, ISK, JEP, JMD, JOD, JPY, KES, KGS, KHR, KID, KMF, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LTL, LVL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRU, MUR, MVR, MWK, MXN, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK, SGD, SHP, SLL, SOS, SRD, SSP, STN, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
non-null

The cost of items in the cart before applying any discounts to certain items. This amount serves as the starting point for calculating any potential savings customers might receive through promotions or discounts.

non-null

A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.

non-null

The three-letter currency code that represents a world currency used in a store. Currency codes include standard standard ISO 4217 codes, legacy codes, and non-standard codes. For example, USD.

AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, BYN, BZD, CAD, CDF, CHF, CLP, CNY, COP, CRC, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, INR, IQD, IRR, ISK, JEP, JMD, JOD, JPY, KES, KGS, KHR, KID, KMF, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LTL, LVL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRU, MUR, MVR, MWK, MXN, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK, SGD, SHP, SLL, SOS, SRD, SSP, STN, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
non-null

The total cost of items in a cart.

non-null

A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.

non-null

The three-letter currency code that represents a world currency used in a store. Currency codes include standard standard ISO 4217 codes, legacy codes, and non-standard codes. For example, USD.

AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, BYN, BZD, CAD, CDF, CHF, CLP, CNY, COP, CRC, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, INR, IQD, IRR, ISK, JEP, JMD, JOD, JPY, KES, KGS, KHR, KID, KMF, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LTL, LVL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRU, MUR, MVR, MWK, MXN, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK, SGD, SHP, SLL, SOS, SRD, SSP, STN, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
non-null

The ID of the cart line.

non-null

The item that the customer intends to purchase.

OBJECT

A custom product represents a product that doesn't map to Shopify's standard product categories. For example, you can use a custom product to manage gift cards, shipping requirements, localized product information, or weight measurements and conversions.

non-null

Whether the merchandise is a gift card.

non-null

Whether the item needs to be shipped to the customer. For example, a digital gift card doesn't need to be shipped, but a t-shirt does need to be shipped.

non-null

The localized name for the product that displays to customers. The title is used to construct the product's handle, which is a unique, human-readable string of the product's title. For example, if a product is titled "Black Sunglasses", then the handle is black-sunglasses.

The product variant's weight, in the system of measurement set in the weightUnit field.

non-null

The unit of measurement for weight.

GRAMS, KILOGRAMS, OUNCES, POUNDS
OBJECT

A specific version of a product that comes in more than one option, such as size or color. For example, if a merchant sells t-shirts with options for size and color, then a small, blue t-shirt would be one product variant and a large, blue t-shirt would be another.

non-null

A globally-unique ID for the product variant.

A custom field that stores additional information about a Shopify resource, such as products, orders, and many more. Using metafields with Shopify Functions enables you to customize the checkout experience.

Arguments

A category that organizes a group of metafields. Namespaces are used to prevent naming conflicts between different apps or different parts of the same app. If omitted, then the app-reserved namespace is used.

required

The unique identifier for the metafield within its namespace. A metafield is composed of a namespace and a key, in the format namespace.key.


Fields

non-null

The data that's stored in the metafield, using JSON format.

non-null

The type of data that the metafield stores in the value field.

non-null

The data that's stored in the metafield. The data is always stored as a string, regardless of the metafield's type.

non-null

The product associated with the product variant. For example, if a merchant sells t-shirts with options for size and color, then a small, blue t-shirt would be one product variant and a large, blue t-shirt would be another. The product associated with the product variant would be the t-shirt itself.

non-null

A unique, human-readable string of the product's title. A handle can contain letters, hyphens (-), and numbers, but not spaces. The handle is used in the online store URL for the product. For example, if a product is titled "Black Sunglasses", then the handle is black-sunglasses.

non-null

Whether the product is associated with any of the specified tags. The product must have at least one tag from the list to return true.

non-null

Whether the product is associated with the specified tags. The product must have all of the tags in the list to return true.

Arguments

required

A comma-separated list of searchable keywords that are associated with the product. For example, "sports, summer" returns products with both the sports and summer tags.


Fields

non-null

Whether the Shopify resource has the tag.

non-null

A searchable keyword that's associated with a Shopify resource, such as a product or customer. For example, a merchant might apply the sports and summer tags to products that are associated with sportswear for summer.

non-null

A globally-unique ID for the product.

non-null

Whether the product is in any of the specified collections. The product must be in at least one collection from the list to return true.

A collection is a group of products that can be displayed in online stores and other sales channels in categories, which makes it easy for customers to find them. For example, an athletics store might create different collections for running attire and accessories.

non-null

Whether the product is in the specified collections. The product must be in all of the collections in the list to return true.

A collection is a group of products that can be displayed in online stores and other sales channels in categories, which makes it easy for customers to find them. For example, an athletics store might create different collections for running attire and accessories.

Arguments

required

A comma-separated list of globally-unique collection IDs that are associated with the product. For example, gid://shopify/Collection/123, gid://shopify/Collection/456.


Fields

non-null

A globally-unique ID for the collection.

non-null

Whether the product is in the specified collection.

non-null

Whether the product is a gift card.

A custom field that stores additional information about a Shopify resource, such as products, orders, and many more. Using metafields with Shopify Functions enables you to customize the checkout experience.

Arguments

A category that organizes a group of metafields. Namespaces are used to prevent naming conflicts between different apps or different parts of the same app. If omitted, then the app-reserved namespace is used.

required

The unique identifier for the metafield within its namespace. A metafield is composed of a namespace and a key, in the format namespace.key.


Fields

non-null

The data that's stored in the metafield, using JSON format.

non-null

The type of data that the metafield stores in the value field.

non-null

The data that's stored in the metafield. The data is always stored as a string, regardless of the metafield's type.

A custom category for a product. Product types allow merchants to define categories other than the ones available in Shopify's standard product categories.

non-null

The localized name for the product that displays to customers. The title is used to construct the product's handle, which is a unique, human-readable string of the product's title. For example, if a product is titled "Black Sunglasses", then the handle is black-sunglasses.

The name of the product's vendor.

non-nullDeprecated
non-null

Whether the item needs to be shipped to the customer. For example, a digital gift card doesn't need to be shipped, but a t-shirt does need to be shipped.

A case-sensitive identifier for the product variant in the merchant's store. For example, "BBC-1". A product variant must have a SKU to be connected to a fulfillment service.

The localized name for the product variant that displays to customers.

The product variant's weight, in the system of measurement set in the weightUnit field.

non-null

The unit of measurement for weight.

GRAMS, KILOGRAMS, OUNCES, POUNDS
non-null

The quantity of the item that the customer intends to purchase.

Anchor to sellingPlanAllocationsellingPlanAllocation

The selling plan associated with the cart line, including information about how a product variant can be sold and purchased.

non-null

A list of price adjustments, with a maximum of two. When there are two, the first price adjustment goes into effect at the time of purchase, while the second one starts after a certain number of orders. A price adjustment represents how a selling plan affects pricing when a variant is purchased with a selling plan. Prices display in the customer's currency if the shop is configured for it.

non-null

The effective price for a single delivery. For example, for a prepaid subscription plan that includes 6 deliveries at the price of $48.00, the per delivery price is $8.00.

non-null

A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.

non-null

The three-letter currency code that represents a world currency used in a store. Currency codes include standard standard ISO 4217 codes, legacy codes, and non-standard codes. For example, USD.

AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, BYN, BZD, CAD, CDF, CHF, CLP, CNY, COP, CRC, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, INR, IQD, IRR, ISK, JEP, JMD, JOD, JPY, KES, KGS, KHR, KID, KMF, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LTL, LVL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRU, MUR, MVR, MWK, MXN, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK, SGD, SHP, SLL, SOS, SRD, SSP, STN, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
non-null

The price of the variant when it's purchased with a selling plan For example, for a prepaid subscription plan that includes 6 deliveries of $10.00 granola, where the customer gets 20% off, the price is 6 x $10.00 x 0.80 = $48.00.

non-null

A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.

non-null

The three-letter currency code that represents a world currency used in a store. Currency codes include standard standard ISO 4217 codes, legacy codes, and non-standard codes. For example, USD.

AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, BYN, BZD, CAD, CDF, CHF, CLP, CNY, COP, CRC, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, INR, IQD, IRR, ISK, JEP, JMD, JOD, JPY, KES, KGS, KHR, KID, KMF, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LTL, LVL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRU, MUR, MVR, MWK, MXN, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK, SGD, SHP, SLL, SOS, SRD, SSP, STN, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
non-null

A representation of how products and variants can be sold and purchased. For example, an individual selling plan could be '6 weeks of prepaid granola, delivered weekly'.

The description of the selling plan.

non-null

A globally-unique identifier.

A custom field that stores additional information about a Shopify resource, such as products, orders, and many more. Using metafields with Shopify Functions enables you to customize the checkout experience.

Arguments

A category that organizes a group of metafields. Namespaces are used to prevent naming conflicts between different apps or different parts of the same app. If omitted, then the app-reserved namespace is used.

required

The unique identifier for the metafield within its namespace. A metafield is composed of a namespace and a key, in the format namespace.key.


Fields

non-null

The data that's stored in the metafield, using JSON format.

non-null

The type of data that the metafield stores in the value field.

non-null

The data that's stored in the metafield. The data is always stored as a string, regardless of the metafield's type.

non-null

The name of the selling plan. For example, '6 weeks of prepaid granola, delivered weekly'.

non-null

Whether purchasing the selling plan will result in multiple deliveries.

non-null

The additional fields on the Cart page that are required for international orders in specific countries, such as customs information or tax identification numbers.

Arguments

required

The keys of the localized fields to retrieve.

SHIPPING_CREDENTIAL_BR, SHIPPING_CREDENTIAL_CL, SHIPPING_CREDENTIAL_CN, SHIPPING_CREDENTIAL_CO, SHIPPING_CREDENTIAL_CR, SHIPPING_CREDENTIAL_EC, SHIPPING_CREDENTIAL_ES, SHIPPING_CREDENTIAL_GT, SHIPPING_CREDENTIAL_ID, SHIPPING_CREDENTIAL_KR, SHIPPING_CREDENTIAL_MX, SHIPPING_CREDENTIAL_MY, SHIPPING_CREDENTIAL_PE, SHIPPING_CREDENTIAL_PT, SHIPPING_CREDENTIAL_PY, SHIPPING_CREDENTIAL_TR, SHIPPING_CREDENTIAL_TW, SHIPPING_CREDENTIAL_TYPE_CO, TAX_CREDENTIAL_BR, TAX_CREDENTIAL_CL, TAX_CREDENTIAL_CO, TAX_CREDENTIAL_CR, TAX_CREDENTIAL_EC, TAX_CREDENTIAL_ES, TAX_CREDENTIAL_GT, TAX_CREDENTIAL_ID, TAX_CREDENTIAL_IT, TAX_CREDENTIAL_MX, TAX_CREDENTIAL_MY, TAX_CREDENTIAL_PE, TAX_CREDENTIAL_PT, TAX_CREDENTIAL_PY, TAX_CREDENTIAL_TR, TAX_CREDENTIAL_TYPE_CO, TAX_CREDENTIAL_TYPE_MX, TAX_CREDENTIAL_USE_MX, TAX_EMAIL_IT

Fields

non-null

The key of the localized field.

SHIPPING_CREDENTIAL_BR, SHIPPING_CREDENTIAL_CL, SHIPPING_CREDENTIAL_CN, SHIPPING_CREDENTIAL_CO, SHIPPING_CREDENTIAL_CR, SHIPPING_CREDENTIAL_EC, SHIPPING_CREDENTIAL_ES, SHIPPING_CREDENTIAL_GT, SHIPPING_CREDENTIAL_ID, SHIPPING_CREDENTIAL_KR, SHIPPING_CREDENTIAL_MX, SHIPPING_CREDENTIAL_MY, SHIPPING_CREDENTIAL_PE, SHIPPING_CREDENTIAL_PT, SHIPPING_CREDENTIAL_PY, SHIPPING_CREDENTIAL_TR, SHIPPING_CREDENTIAL_TW, SHIPPING_CREDENTIAL_TYPE_CO, TAX_CREDENTIAL_BR, TAX_CREDENTIAL_CL, TAX_CREDENTIAL_CO, TAX_CREDENTIAL_CR, TAX_CREDENTIAL_EC, TAX_CREDENTIAL_ES, TAX_CREDENTIAL_GT, TAX_CREDENTIAL_ID, TAX_CREDENTIAL_IT, TAX_CREDENTIAL_MX, TAX_CREDENTIAL_MY, TAX_CREDENTIAL_PE, TAX_CREDENTIAL_PT, TAX_CREDENTIAL_PY, TAX_CREDENTIAL_TR, TAX_CREDENTIAL_TYPE_CO, TAX_CREDENTIAL_TYPE_MX, TAX_CREDENTIAL_USE_MX, TAX_EMAIL_IT
non-null

The title of the localized field.

The value of the localized field.

The physical location where a retail order is created or completed.

non-null

The address of this location.

The first line of the address for the location.

The second line of the address for the location.

The city of the location.

The country of the location.

The country code of the location.

non-null

A formatted version of the address for the location.

The approximate latitude coordinates of the location.

The approximate longitude coordinates of the location.

The phone number of the location.

The province of the location.

The code for the province, state, or district of the address of the location.

The ZIP code of the location.

non-null

The location handle.

non-null

The location id.

non-null

Local pickup settings associated with a location.

non-null

Whether local pickup is enabled for the location.

A custom field that stores additional information about a Shopify resource, such as products, orders, and many more. Using metafields with Shopify Functions enables you to customize the checkout experience.

Arguments

A category that organizes a group of metafields. Namespaces are used to prevent naming conflicts between different apps or different parts of the same app. If omitted, then the app-reserved namespace is used.

required

The unique identifier for the metafield within its namespace. A metafield is composed of a namespace and a key, in the format namespace.key.


Fields

non-null

The data that's stored in the metafield, using JSON format.

non-null

The type of data that the metafield stores in the value field.

non-null

The data that's stored in the metafield. The data is always stored as a string, regardless of the metafield's type.

non-null

The name of the location.

The information about promotional offers that are applied to items in a cart, such as the discount's name that displays to merchants in the Shopify admin and to customers, the discount code, the discount class, and metafields that are associated with discounts.

The discount code, for code-based discounts.

Anchor to discountApplicationStrategydiscountApplicationStrategy
non-null

The strategy to use when considering discounts proposals.

ALL, FIRST, MAXIMUM
non-null

The class of the discount.

ORDER, PRODUCT
non-null

Proposals to evaluate as part of this discount.

non-null

The handle of the discount proposal.

The message for this proposal.

non-null

The line items to which the discount proposal applies.

non-null

The ID of the line to be discounted.

non-null

The quantity of the items on this line to be discounted.

non-null

The value of the discount. The value can be a fixed amount, like $5 (5.0), or a percentage, such as 10% (0.1).

OBJECT

A fixed amount value.

non-null

The fixed amount value of the discount, in the currency of the cart.

non-null

Allocation method of the discount, will be allocated on each line if it's true, else will be allocated across target lines.

OBJECT

A percentage value.

non-null

The percentage value.

non-null

The ID of the discount.

A custom field that stores additional information about a Shopify resource, such as products, orders, and many more. Using metafields with Shopify Functions enables you to customize the checkout experience.

Arguments

A category that organizes a group of metafields. Namespaces are used to prevent naming conflicts between different apps or different parts of the same app. If omitted, then the app-reserved namespace is used.

required

The unique identifier for the metafield within its namespace. A metafield is composed of a namespace and a key, in the format namespace.key.


Fields

non-null

The data that's stored in the metafield, using JSON format.

non-null

The type of data that the metafield stores in the value field.

non-null

The data that's stored in the metafield. The data is always stored as a string, regardless of the metafield's type.

non-null

The discount title.

non-null

The regional and language settings that determine how the Function handles currency, numbers, dates, and other locale-specific values during discount calculations. These settings are based on the store's configured localization practices.

non-null

The country for which the store is customized, reflecting local preferences and regulations. Localization might influence the language, currency, and product offerings available in a store to enhance the shopping experience for customers in that region.

non-null

The ISO code of the country.

AC, AD, AE, AF, AG, AI, AL, AM, AN, AO, AR, AT, AU, AW, AX, AZ, BA, BB, BD, BE, BF, BG, BH, BI, BJ, BL, BM, BN, BO, BQ, BR, BS, BT, BV, BW, BY, BZ, CA, CC, CD, CF, CG, CH, CI, CK, CL, CM, CN, CO, CR, CU, CV, CW, CX, CY, CZ, DE, DJ, DK, DM, DO, DZ, EC, EE, EG, EH, ER, ES, ET, FI, FJ, FK, FO, FR, GA, GB, GD, GE, GF, GG, GH, GI, GL, GM, GN, GP, GQ, GR, GS, GT, GW, GY, HK, HM, HN, HR, HT, HU, ID, IE, IL, IM, IN, IO, IQ, IR, IS, IT, JE, JM, JO, JP, KE, KG, KH, KI, KM, KN, KP, KR, KW, KY, KZ, LA, LB, LC, LI, LK, LR, LS, LT, LU, LV, LY, MA, MC, MD, ME, MF, MG, MK, ML, MM, MN, MO, MQ, MR, MS, MT, MU, MV, MW, MX, MY, MZ, NA, NC, NE, NF, NG, NI, NL, NO, NP, NR, NU, NZ, OM, PA, PE, PF, PG, PH, PK, PL, PM, PN, PS, PT, PY, QA, RE, RO, RS, RU, RW, SA, SB, SC, SD, SE, SG, SH, SI, SJ, SK, SL, SM, SN, SO, SR, SS, ST, SV, SX, SY, SZ, TA, TC, TD, TF, TG, TH, TJ, TK, TL, TM, TN, TO, TR, TT, TV, TW, TZ, UA, UG, UM, US, UY, UZ, VA, VC, VE, VG, VN, VU, WF, WS, XK, YE, YT, ZA, ZM, ZW, ZZ
non-null

The language for which the store is customized, ensuring content is tailored to local customers. This includes product descriptions and customer communications that resonate with the target audience.

non-null

The ISO code.

AF, AK, AM, AR, AS, AZ, BE, BG, BM, BN, BO, BR, BS, CA, CE, CKB, CS, CU, CY, DA, DE, DZ, EE, EL, EN, EO, ES, ET, EU, FA, FF, FI, FIL, FO, FR, FY, GA, GD, GL, GU, GV, HA, HE, HI, HR, HU, HY, IA, ID, IG, II, IS, IT, JA, JV, KA, KI, KK, KL, KM, KN, KO, KS, KU, KW, KY, LB, LG, LN, LO, LT, LU, LV, MG, MI, MK, ML, MN, MR, MS, MT, MY, NB, ND, NE, NL, NN, NO, OM, OR, OS, PA, PL, PS, PT, PT_BR, PT_PT, QU, RM, RN, RO, RU, RW, SA, SC, SD, SE, SG, SI, SK, SL, SN, SO, SQ, SR, SU, SV, SW, TA, TE, TG, TH, TI, TK, TO, TR, TT, UG, UK, UR, UZ, VI, VO, WO, XH, YI, YO, ZH, ZH_CN, ZH_TW, ZU
non-nullDeprecated
Anchor to presentmentCurrencyRatepresentmentCurrencyRate
non-null

The exchange rate used to convert discounts between the shop's default currency and the currency that displays to the customer during checkout. For example, if a store operates in USD but a customer is viewing discounts in EUR, then the presentment currency rate handles this conversion for accurate pricing.

non-null

Information about the shop where the Function is running, including the shop's timezone setting and associated metafields.

non-null

The current time based on the store's timezone setting.

non-null

The current date relative to the parent object.

non-null

Returns true if the current date and time is at or past the given date and time, and false otherwise.

non-null

Returns true if the current date and time is before the given date and time, and false otherwise.

non-null

Returns true if the current date and time is between the two given date and times, and false otherwise.

non-null

Returns true if the current time is at or past the given time, and false otherwise.

non-null

Returns true if the current time is at or past the given time, and false otherwise.

non-null

Returns true if the current time is between the two given times, and false otherwise.

A custom field that stores additional information about a Shopify resource, such as products, orders, and many more. Using metafields with Shopify Functions enables you to customize the checkout experience.

Arguments

A category that organizes a group of metafields. Namespaces are used to prevent naming conflicts between different apps or different parts of the same app. If omitted, then the app-reserved namespace is used.

required

The unique identifier for the metafield within its namespace. A metafield is composed of a namespace and a key, in the format namespace.key.


Fields

non-null

The data that's stored in the metafield, using JSON format.

non-null

The type of data that the metafield stores in the value field.

non-null

The data that's stored in the metafield. The data is always stored as a string, regardless of the metafield's type.

The logic that processes the input data to generate a standardized list of discounts that apply to each item in a cart.

The list of discounts specifies the money amount that's allocated to an item in a cart based on the associated discount. Shopify processes your response to determine how to calculate discounts on items in a cart.

This return must follow the schema defined in the FunctionRunResult object.

OBJECT

The FunctionRunResult object is the output of the Function run target. The object contains a list of discounts that apply to each item in a cart.

A list of errors that display if a discount can't be applied to one or more items in a cart. Errors lock checkout, and the customer has to remove the discount code to proceed through checkout.

Shopify shows errors for only code discounts. Custom error messages aren't currently supported. If errors are returned with a custom reason, then the error won't display and the discount won't be added.

non-null

The ID of the discount that caused this violation.

non-null

The error message in the user's locale.

The list of discounts that are applied to each item in a cart. It includes data such as the ID of the cart line associated with the discount, the quantity of items that the discount applies to, and how the discount is allocated to each item.

non-null

The output allocations for this line discount.

non-null

The money amount that's allocated to a line based on the associated discount.

non-null

The ID of the source discount proposal.

non-null

The ID of the cart line associated to this discount.

non-null

The quantity to which this line discount will apply.

Was this section helpful?

The following errors can occur when using the Discounts Allocator API:

Errors that can occur when using the Discounts Allocator API
Error codeMessage
DISCOUNT_ALREADY_APPLIEDDiscount already applied.
DISCOUNT_CODE_APPLICATION_FAILEDDiscount code isn't working right now. Please contact us for help.
HIGHER_VALUE_DISCOUNT_APPLIEDHigher value discount applied.
MAXIMUM_DISCOUNT_CODE_LIMIT_REACHEDMaximum number of discount codes limit reached.
DISCOUNT_NOT_FOUNDDiscount not found.
CURRENTLY_INACTIVEDiscount is inactive.
USAGE_LIMIT_REACHEDThe discount usage limit has been reached.
CUSTOMER_USAGE_LIMIT_REACHEDGiven customer does not qualify for the discount.
CUSTOMER_NOT_ELIGIBLECustomer usage limit has been reached.
QUANTITY_NOT_IN_RANGEThe quantity of items does not qualify for the discount.
PURCHASE_NOT_IN_RANGEThe purchase amount of items does not qualify for the discount.
NO_ENTITLED_LINE_ITEMSDiscount does not apply to any of the given line items.
NO_ENTITLED_SHIPPING_LINESNo applicable shipping lines.
INCOMPATIBLE_PURCHASE_TYPEThe purchase type doesn't qualify for the discount.
Was this section helpful?