Payment Customization Function API
A payment customization enables you to rename, reorder, hide the payment methods available to customers during checkout, set payment terms, and add a review requirement for a specific order. Examples of payment methods that you can customize include credit cards, gift cards, and wallets such as Shop Pay, Apple Pay, and Google Pay.
Payment terms allow buyers to pay for their order at a later date instead of at checkout, and can be set as fixed, net, or event-based terms with optional deposits. To customize payment methods and payment terms in checkout, you can use the Payment Customization Function API.
A review requirement enables you to control whether an order is submitted as a draft for review. Using the Payment Customization Function API, you can add a review requirement to an order based on conditions such as order value or cart contents. (B2B orders only. See limitations)
Shopify Functions enable you to customize Shopify's backend logic. The Payment Customization Function API integrates this logic into the checkout flow.
Use the API to reorder, rename, hide payment methods, set payment terms, and add a review requirement in checkout, with associated data.
You can activate a maximum of 25 payment customization functions on each store.
You can activate a maximum of 25 payment customization functions on each store.
Anchor to Use casesUse cases
- Hide payment methods for carts with totals above or below a given value.
- Reorder payment methods, such as credit cards, according to customer preference.
- Hide payment methods based on the customer's country.
- Hide and disable gift cards based on data such as cart contents and country.
- Set payment terms with deposits for high-value orders.
- Apply net payment terms based on buyer identity.
- Set a review requirement for specific orders, such as high-value ones.
Function target
Checkout

- B2B: Supported
- Cart: Not supported
- Checkout: Supported
- Create Order API: Not supported
- Draft Order (Admin): Not supported
- Draft Order (Checkout): Supported
- Order Edit (Admin): Not supported
- Order Edit (Checkout): Not supported
- POS: Not supported
- Pre-order and Try Before You Buy: Supported
- Shopify Admin: Not supported
- Storefront: Not supported
- Storefront Accelerated Checkout: Partially supportedPayment terms aren't supported in storefront accelerated checkouts.
- Subscription (Recurring Orders): Not supported
- B2B: Supported
- Cart: Not supported
- Checkout: Supported
- Create Order API: Not supported
- Draft Order (Admin): Not supported
- Draft Order (Checkout): Supported
- Order Edit (Admin): Not supported
- Order Edit (Checkout): Not supported
- POS: Not supported
- Pre-order and Try Before You Buy: Supported
- Shopify Admin: Not supported
- Storefront: Not supported
- Storefront Accelerated Checkout: Partially supportedPayment terms aren't supported in storefront accelerated checkouts.
- Subscription (Recurring Orders): Not supported
Payment terms are incompatible with subscriptions. Payment customization functions cannot set payment terms when the cart contains items with subscription selling plans.
Payment terms are incompatible with subscriptions. Payment customization functions cannot set payment terms when the cart contains items with subscription selling plans.
Anchor to Getting startedGetting started
Scaffolding the function using Shopify CLI automatically configures your TOML file. You can alter the default configuration to customize the way your function operates.
Terminal
Anchor to TargetsTargets
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.
Anchor to Run targetRun target
cart.payment-methods.transform.run
The run target customizes payment methods using either Shopify data or hardcoded values. The target returns an ordered list of operations to be applied to payment methods, payment terms, and review requirements.
For example, you might use this to hide a payment method for B2B customers, set fixed payment terms with a deposit for orders above a certain threshold or add a review requirement for a high-value order.
- Input
- Anchor to InputInputOBJECT
The
Inputobject is the complete GraphQL schema that your function can query as an input to customize the payment methods that are available to customers during checkout. 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.- Anchor to cartcart•Cart!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.
- Anchor to attributeattribute•Attribute
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.
- •String
The key of the cart attribute to retrieve. For example,
.
Arguments
- •String!non-null
The key or name of the attribute. For example,
.- Anchor to valuevalue•String
The value of the attribute. For example,
"true".
Fields
- •
- Anchor to billingAddressbilling•
Address MailingAddress The billing address associated with the cart.
- Anchor to address1address1•String
The first line of the address. Typically the street address or PO Box number.
- Anchor to address2address2•String
The second line of the address. Typically the number of the apartment, suite, or unit.
- Anchor to citycity•String
The name of the city, district, village, or town.
- Anchor to companycompany•String
The name of the customer's company or organization.
- Anchor to countryCodecountry•
Code CountryCode 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- Anchor to firstNamefirst•
Name String The first name of the customer.
- Anchor to lastNamelast•
Name String The last name of the customer.
- Anchor to latitudelatitude•Float
The approximate latitude of the address.
- Anchor to longitudelongitude•Float
The approximate longitude of the address.
- Anchor to namename•String
The full name of the customer, based on firstName and lastName.
- Anchor to phonephone•String
A unique phone number for the customer. Formatted using E.164 standard. For example, +16135551111.
- Anchor to provinceCodeprovince•
Code String The alphanumeric code for the region. For example, ON.
- •String
The zip or postal code of the address.
- Anchor to marketmarket•MarketDeprecated
- Anchor to handlehandle•Handle!non-null
A human-readable unique string for the market automatically generated from its title.
- •ID!non-null
A globally-unique identifier.
- Anchor to metafieldmetafield•Metafield
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.
- Anchor to namespacenamespace•String
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.
- •String!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.
Arguments
- Anchor to jsonValuejson•
Value JSON!non-null The data that's stored in the metafield, using JSON format.
- Anchor to typetype•String!non-null
The type of data that the metafield stores in the
valuefield.- Anchor to valuevalue•String!non-null
The data that's stored in the metafield. The data is always stored as a string, regardless of the metafield's type.
Fields
- Anchor to regionsregions•[Market
Region!]! non-null A geographic region which comprises a market.
- Anchor to namename•String
The name of the region in the language of the current localization.
- Anchor to buyerIdentitybuyer•
Identity BuyerIdentity 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.
- Anchor to customercustomer•Customer
The customer that's interacting with the cart.
- Anchor to amountSpentamount•
Spent MoneyV2! 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.
- Anchor to amountamount•Decimal!non-null
A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.
- Anchor to currencyCodecurrency•
Code CurrencyCode! 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, USDC, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
- Anchor to displayNamedisplay•
Name String!non-null The full name of the customer, based on the values for
and. Ifandaren'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.- Anchor to emailemail•String
The customer's email address.
- Anchor to firstNamefirst•
Name String The customer's first name.
- Anchor to hasAnyTaghas•
Any Tag Boolean!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.- •[String!]!requiredDefault:[]
A comma-separated list of searchable keywords that are associated with the customer. For example,
"VIP, Gold"returns customers with either theVIPorGoldtag.
Arguments
- •
- Anchor to hasTagshas•
Tags [HasTag Response!]! non-null Whether the customer is associated with the specified tags.
- •[String!]!requiredDefault:[]
A comma-separated list of searchable keywords that are associated with the customer. For example,
"VIP, Gold"returns customers with both theVIPandGoldtags.
Arguments
- Anchor to hasTaghas•
Tag Boolean!non-null Whether the Shopify resource has the tag.
- •String!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
sportsandsummertags to products that are associated with sportswear for summer.
Fields
- •
- •ID!non-null
A globally-unique ID for the customer.
- Anchor to lastNamelast•
Name String The customer's last name.
- Anchor to metafieldmetafield•Metafield
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.
- Anchor to namespacenamespace•String
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.
- •String!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.
Arguments
- Anchor to jsonValuejson•
Value JSON!non-null The data that's stored in the metafield, using JSON format.
- Anchor to typetype•String!non-null
The type of data that the metafield stores in the
valuefield.- Anchor to valuevalue•String!non-null
The data that's stored in the metafield. The data is always stored as a string, regardless of the metafield's type.
Fields
- Anchor to numberOfOrdersnumber•
Of Orders Int!non-null The total number of orders that the customer has made at the store.
- Anchor to emailemail•String
The email address of the customer that's interacting with the cart.
- Anchor to isAuthenticatedis•
Authenticated Boolean!non-null Whether the customer is authenticated through their customer account.
- Anchor to phonephone•String
The phone number of the customer that's interacting with the cart.
- Anchor to purchasingCompanypurchasing•
Company PurchasingCompany 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.
- Anchor to companycompany•Company!non-null
The company associated to the order or draft order.
- Anchor to createdAtcreated•
At DateTime! non-null The date and time (ISO 8601 format) at which the company was created in Shopify.
- Anchor to externalIdexternal•
Id String A unique externally-supplied ID for the company.
- •ID!non-null
The ID of the company.
- Anchor to metafieldmetafield•Metafield
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.
- Anchor to namespacenamespace•String
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.
- •String!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.
Arguments
- Anchor to jsonValuejson•
Value JSON!non-null The data that's stored in the metafield, using JSON format.
- Anchor to typetype•String!non-null
The type of data that the metafield stores in the
valuefield.- Anchor to valuevalue•String!non-null
The data that's stored in the metafield. The data is always stored as a string, regardless of the metafield's type.
Fields
- Anchor to namename•String!non-null
The name of the company.
- Anchor to updatedAtupdated•
At DateTime! non-null The date and time (ISO 8601 format) at which the company was last modified.
- Anchor to contactcontact•Company
Contact The company contact associated to the order or draft order.
- Anchor to createdAtcreated•
At DateTime! non-null The date and time (ISO 8601 format) at which the company contact was created in Shopify.
- •ID!non-null
The ID of the company.
- Anchor to localelocale•String
The company contact's locale (language).
- Anchor to titletitle•String
The company contact's job title.
- Anchor to updatedAtupdated•
At DateTime! non-null The date and time (ISO 8601 format) at which the company contact was last modified.
- Anchor to locationlocation•Company
Location! non-null The company location associated to the order or draft order.
- Anchor to createdAtcreated•
At DateTime! non-null The date and time (ISO 8601 format) at which the company location was created in Shopify.
- Anchor to externalIdexternal•
Id String A unique externally-supplied ID for the company.
- •ID!non-null
The ID of the company.
- Anchor to localelocale•String
The preferred locale of the company location.
- Anchor to metafieldmetafield•Metafield
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.
- Anchor to namespacenamespace•String
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.
- •String!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.
Arguments
- Anchor to jsonValuejson•
Value JSON!non-null The data that's stored in the metafield, using JSON format.
- Anchor to typetype•String!non-null
The type of data that the metafield stores in the
valuefield.- Anchor to valuevalue•String!non-null
The data that's stored in the metafield. The data is always stored as a string, regardless of the metafield's type.
Fields
- Anchor to namename•String!non-null
The name of the company location.
- Anchor to ordersCountorders•
Count Int!non-null The number of orders placed at this company location.
- Anchor to totalSpenttotal•
Spent MoneyV2! non-null The total amount spent at this company location.
- Anchor to amountamount•Decimal!non-null
A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.
- Anchor to currencyCodecurrency•
Code CurrencyCode! 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, USDC, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
- Anchor to updatedAtupdated•
At DateTime! non-null The date and time (ISO 8601 format) at which the company location was last modified.
- Anchor to costcost•Cart
Cost! 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.
- Anchor to subtotalAmountsubtotal•
Amount MoneyV2! non-null The amount, before taxes and cart-level discounts, for the customer to pay.
- Anchor to amountamount•Decimal!non-null
A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.
- Anchor to currencyCodecurrency•
Code CurrencyCode! 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, USDC, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
- Anchor to totalAmounttotal•
Amount MoneyV2! non-null The total amount for the customer to pay at checkout.
- Anchor to amountamount•Decimal!non-null
A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.
- Anchor to currencyCodecurrency•
Code CurrencyCode! 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, USDC, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
- Anchor to totalDutyAmounttotal•
Duty Amount MoneyV2 The duty charges for a customer to pay at checkout.
- Anchor to amountamount•Decimal!non-null
A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.
- Anchor to currencyCodecurrency•
Code CurrencyCode! 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, USDC, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
- Anchor to totalTaxAmounttotal•
Tax Amount MoneyV2 The total tax amount for the customer to pay at checkout.
- Anchor to amountamount•Decimal!non-null
A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.
- Anchor to currencyCodecurrency•
Code CurrencyCode! 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, USDC, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
- Anchor to deliverableLinesdeliverable•
Lines [DeliverableCart Line!]! non-null The items in a cart that are eligible for fulfillment and can be delivered to the customer.
- Anchor to attributeattribute•Attribute
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
object in Liquid.- •String
The key of the cart attribute to retrieve. For example,
.
Arguments
- •String!non-null
The key or name of the attribute. For example,
.- Anchor to valuevalue•String
The value of the attribute. For example,
"true".
Fields
- •
- •ID!non-null
The ID of the cart line.
- Anchor to merchandisemerchandise•Merchandise!non-null
The item that the customer intends to purchase.
- Anchor to CustomProduct•OBJECTCustom
Product 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.
- Anchor to isGiftCardis•
Gift Card Boolean!non-null Whether the merchandise is a gift card.
- Anchor to requiresShippingrequires•
Shipping Boolean!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.
- Anchor to titletitle•String!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.- Anchor to weightweight•Float
The product variant's weight, in the system of measurement set in the
field.- Anchor to weightUnitweight•
Unit WeightUnit! non-null The unit of measurement for weight.
GRAMS, KILOGRAMS, OUNCES, POUNDS
- Anchor to ProductVariant•OBJECTProduct
Variant 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.
- •ID!non-null
A globally-unique ID for the product variant.
- Anchor to metafieldmetafield•Metafield
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.
- Anchor to namespacenamespace•String
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.
- •String!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.
Arguments
- Anchor to jsonValuejson•
Value JSON!non-null The data that's stored in the metafield, using JSON format.
- Anchor to typetype•String!non-null
The type of data that the metafield stores in the
valuefield.- Anchor to valuevalue•String!non-null
The data that's stored in the metafield. The data is always stored as a string, regardless of the metafield's type.
Fields
- Anchor to productproduct•Product!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.
- Anchor to handlehandle•Handle!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 isblack-sunglasses.- Anchor to hasAnyTaghas•
Any Tag Boolean!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.- •[String!]!requiredDefault:[]
A comma-separated list of searchable keywords that are associated with the product. For example,
"sports, summer"returns products with either thesportsorsummertag.
Arguments
- •
- Anchor to hasTagshas•
Tags [HasTag Response!]! non-null Whether the product is associated with the specified tags.
- •[String!]!requiredDefault:[]
A comma-separated list of searchable keywords that are associated with the product. For example,
"sports, summer"returns products with both thesportsandsummertags.
Arguments
- Anchor to hasTaghas•
Tag Boolean!non-null Whether the Shopify resource has the tag.
- •String!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
sportsandsummertags to products that are associated with sportswear for summer.
Fields
- •
- •ID!non-null
A globally-unique ID for the product.
- Anchor to inAnyCollectionin•
Any Collection Boolean!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.
- •[ID!]!requiredDefault:[]
A comma-separated list of globally-unique collection IDs that are associated with the product. For example,
,.
Arguments
- •
- Anchor to inCollectionsin•
Collections [CollectionMembership!]! 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.
- •[ID!]!requiredDefault:[]
A comma-separated list of globally-unique collection IDs that are associated with the product. For example,
,.
Arguments
- Anchor to collectionIdcollection•
Id ID!non-null A globally-unique ID for the collection.
- Anchor to isMemberis•
Member Boolean!non-null Whether the product is in the specified collection.
Fields
- •
- Anchor to isGiftCardis•
Gift Card Boolean!non-null Whether the product is a gift card.
- Anchor to metafieldmetafield•Metafield
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.
- Anchor to namespacenamespace•String
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.
- •String!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.
Arguments
- Anchor to jsonValuejson•
Value JSON!non-null The data that's stored in the metafield, using JSON format.
- Anchor to typetype•String!non-null
The type of data that the metafield stores in the
valuefield.- Anchor to valuevalue•String!non-null
The data that's stored in the metafield. The data is always stored as a string, regardless of the metafield's type.
Fields
- Anchor to productTypeproduct•
Type String A custom category for a product. Product types allow merchants to define categories other than the ones available in Shopify's standard product categories.
- Anchor to titletitle•String!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.- Anchor to vendorvendor•String
The name of the product's vendor.
- Anchor to requiresShippingrequires•
Shipping Boolean!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.
- •String
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.- Anchor to titletitle•String
The localized name for the product variant that displays to customers.
- Anchor to weightweight•Float
The product variant's weight, in the system of measurement set in the
field.- Anchor to weightUnitweight•
Unit WeightUnit! non-null The unit of measurement for weight.
GRAMS, KILOGRAMS, OUNCES, POUNDS
- •
- Anchor to quantityquantity•Int!non-null
The quantity of the item that the customer intends to purchase.
- Anchor to deliveryGroupsdelivery•
Groups [CartDelivery Group!]! 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
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.- Anchor to cartLinescart•
Lines [CartLine!]! 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.
- Anchor to attributeattribute•Attribute
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
object in Liquid.- •String
The key of the cart attribute to retrieve. For example,
.
Arguments
- •String!non-null
The key or name of the attribute. For example,
.- Anchor to valuevalue•String
The value of the attribute. For example,
"true".
Fields
- •
- Anchor to costcost•Cart
Line Cost! 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.
- Anchor to amountPerQuantityamount•
Per Quantity MoneyV2! 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
is $10.- Anchor to amountamount•Decimal!non-null
A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.
- Anchor to currencyCodecurrency•
Code CurrencyCode! 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, USDC, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
- Anchor to compareAtAmountPerQuantitycompare•
At Amount Per Quantity MoneyV2 The
price 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'sis $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 isnullwhen the value is hidden from buyers.- Anchor to amountamount•Decimal!non-null
A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.
- Anchor to currencyCodecurrency•
Code CurrencyCode! 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, USDC, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
- Anchor to subtotalAmountsubtotal•
Amount MoneyV2! 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.
- Anchor to amountamount•Decimal!non-null
A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.
- Anchor to currencyCodecurrency•
Code CurrencyCode! 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, USDC, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
- Anchor to totalAmounttotal•
Amount MoneyV2! non-null The total cost of items in a cart.
- Anchor to amountamount•Decimal!non-null
A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.
- Anchor to currencyCodecurrency•
Code CurrencyCode! 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, USDC, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
- Anchor to discountAllocationsdiscount•
Allocations [DiscountAllocation!]! non-null The discounts that have been applied to the cart line.
- Anchor to discountApplicationdiscount•
Application DiscountApplication! non-null The discount that was applied.
- Anchor to allocationMethodallocation•
Method DiscountApplication Allocation Method! non-null The method by which the discount's value is allocated to its entitled items.
ACROSS, EACH- Anchor to metafieldmetafield•Metafield
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.
- Anchor to namespacenamespace•String
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.
- •String!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.
Arguments
- Anchor to jsonValuejson•
Value JSON!non-null The data that's stored in the metafield, using JSON format.
- Anchor to typetype•String!non-null
The type of data that the metafield stores in the
valuefield.- Anchor to valuevalue•String!non-null
The data that's stored in the metafield. The data is always stored as a string, regardless of the metafield's type.
Fields
- Anchor to targetSelectiontarget•
Selection DiscountApplication Target Selection! non-null The lines on the cart targeted by the discount.
ALL, ENTITLED, EXPLICIT- Anchor to targetTypetarget•
Type DiscountApplication Target! non-null The type of line (i.e. line item or shipping line) on a cart that the discount is applicable towards.
LINE_ITEM, SHIPPING_LINE- Anchor to totalAllocatedAmounttotal•
Allocated Amount MoneyV2! non-null The total allocated amount of the discount across all items.
- Anchor to amountamount•Decimal!non-null
A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.
- Anchor to currencyCodecurrency•
Code CurrencyCode! 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, USDC, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
- Anchor to valuevalue•Pricing
Value! non-null The value of the discount.
- Anchor to MoneyV2•OBJECTMoney
V2 A precise monetary value and its associated currency. Combines a decimal amount with a three-letter currency code to express prices, costs, and other financial values throughout the API. For example, 12.99 USD.
- Anchor to amountamount•Decimal!non-null
A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.
- Anchor to currencyCodecurrency•
Code CurrencyCode! 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, USDC, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
- Anchor to PricingPercentageValue•OBJECTPricing
Percentage Value The percentage value of a discount.
- Anchor to valuevalue•Decimal!non-null
The percentage value of the discount.
- Anchor to discountedAmountdiscounted•
Amount MoneyV2! non-null The amount that was discounted.
- Anchor to amountamount•Decimal!non-null
A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.
- Anchor to currencyCodecurrency•
Code CurrencyCode! 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, USDC, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
- •ID!non-null
The ID of the cart line.
- Anchor to merchandisemerchandise•Merchandise!non-null
The item that the customer intends to purchase.
- Anchor to CustomProduct•OBJECTCustom
Product 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.
- Anchor to isGiftCardis•
Gift Card Boolean!non-null Whether the merchandise is a gift card.
- Anchor to requiresShippingrequires•
Shipping Boolean!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.
- Anchor to titletitle•String!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.- Anchor to weightweight•Float
The product variant's weight, in the system of measurement set in the
field.- Anchor to weightUnitweight•
Unit WeightUnit! non-null The unit of measurement for weight.
GRAMS, KILOGRAMS, OUNCES, POUNDS
- Anchor to ProductVariant•OBJECTProduct
Variant 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.
- •ID!non-null
A globally-unique ID for the product variant.
- Anchor to metafieldmetafield•Metafield
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.
- Anchor to namespacenamespace•String
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.
- •String!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.
Arguments
- Anchor to jsonValuejson•
Value JSON!non-null The data that's stored in the metafield, using JSON format.
- Anchor to typetype•String!non-null
The type of data that the metafield stores in the
valuefield.- Anchor to valuevalue•String!non-null
The data that's stored in the metafield. The data is always stored as a string, regardless of the metafield's type.
Fields
- Anchor to productproduct•Product!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.
- Anchor to handlehandle•Handle!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 isblack-sunglasses.- Anchor to hasAnyTaghas•
Any Tag Boolean!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.- •[String!]!requiredDefault:[]
A comma-separated list of searchable keywords that are associated with the product. For example,
"sports, summer"returns products with either thesportsorsummertag.
Arguments
- •
- Anchor to hasTagshas•
Tags [HasTag Response!]! non-null Whether the product is associated with the specified tags.
- •[String!]!requiredDefault:[]
A comma-separated list of searchable keywords that are associated with the product. For example,
"sports, summer"returns products with both thesportsandsummertags.
Arguments
- Anchor to hasTaghas•
Tag Boolean!non-null Whether the Shopify resource has the tag.
- •String!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
sportsandsummertags to products that are associated with sportswear for summer.
Fields
- •
- •ID!non-null
A globally-unique ID for the product.
- Anchor to inAnyCollectionin•
Any Collection Boolean!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.
- •[ID!]!requiredDefault:[]
A comma-separated list of globally-unique collection IDs that are associated with the product. For example,
,.
Arguments
- •
- Anchor to inCollectionsin•
Collections [CollectionMembership!]! 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.
- •[ID!]!requiredDefault:[]
A comma-separated list of globally-unique collection IDs that are associated with the product. For example,
,.
Arguments
- Anchor to collectionIdcollection•
Id ID!non-null A globally-unique ID for the collection.
- Anchor to isMemberis•
Member Boolean!non-null Whether the product is in the specified collection.
Fields
- •
- Anchor to isGiftCardis•
Gift Card Boolean!non-null Whether the product is a gift card.
- Anchor to metafieldmetafield•Metafield
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.
- Anchor to namespacenamespace•String
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.
- •String!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.
Arguments
- Anchor to jsonValuejson•
Value JSON!non-null The data that's stored in the metafield, using JSON format.
- Anchor to typetype•String!non-null
The type of data that the metafield stores in the
valuefield.- Anchor to valuevalue•String!non-null
The data that's stored in the metafield. The data is always stored as a string, regardless of the metafield's type.
Fields
- Anchor to productTypeproduct•
Type String A custom category for a product. Product types allow merchants to define categories other than the ones available in Shopify's standard product categories.
- Anchor to titletitle•String!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.- Anchor to vendorvendor•String
The name of the product's vendor.
- Anchor to requiresShippingrequires•
Shipping Boolean!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.
- •String
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.- Anchor to titletitle•String
The localized name for the product variant that displays to customers.
- Anchor to weightweight•Float
The product variant's weight, in the system of measurement set in the
field.- Anchor to weightUnitweight•
Unit WeightUnit! non-null The unit of measurement for weight.
GRAMS, KILOGRAMS, OUNCES, POUNDS
- •
- Anchor to parentRelationshipparent•
Relationship CartLine Parent Relationship The nested relationship between this line and its parent line, if any.
- Anchor to parentparent•Cart
Line! non-null The parent line in the relationship.
- Anchor to quantityquantity•Int!non-null
The quantity of the item that the customer intends to purchase.
- Anchor to sellingPlanAllocationselling•
Plan Allocation SellingPlan Allocation The selling plan associated with the cart line, including information about how a product variant can be sold and purchased.
- Anchor to priceAdjustmentsprice•
Adjustments [SellingPlan Allocation Price Adjustment!]! 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.
- Anchor to perDeliveryPriceper•
Delivery Price MoneyV2! 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.
- Anchor to amountamount•Decimal!non-null
A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.
- Anchor to currencyCodecurrency•
Code CurrencyCode! 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, USDC, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
- Anchor to priceprice•Money
V2! 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.
- Anchor to amountamount•Decimal!non-null
A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.
- Anchor to currencyCodecurrency•
Code CurrencyCode! 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, USDC, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
- Anchor to sellingPlanselling•
Plan SellingPlan! 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'.
- Anchor to descriptiondescription•String
The description of the selling plan.
- •ID!non-null
A globally-unique identifier.
- Anchor to metafieldmetafield•Metafield
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.
- Anchor to namespacenamespace•String
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.
- •String!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.
Arguments
- Anchor to jsonValuejson•
Value JSON!non-null The data that's stored in the metafield, using JSON format.
- Anchor to typetype•String!non-null
The type of data that the metafield stores in the
valuefield.- Anchor to valuevalue•String!non-null
The data that's stored in the metafield. The data is always stored as a string, regardless of the metafield's type.
Fields
- Anchor to namename•String!non-null
The name of the selling plan. For example, '6 weeks of prepaid granola, delivered weekly'.
- Anchor to recurringDeliveriesrecurring•
Deliveries Boolean!non-null Whether purchasing the selling plan will result in multiple deliveries.
- Anchor to deliveryAddressdelivery•
Address MailingAddress The shipping or destination address associated with the delivery group.
- Anchor to address1address1•String
The first line of the address. Typically the street address or PO Box number.
- Anchor to address2address2•String
The second line of the address. Typically the number of the apartment, suite, or unit.
- Anchor to citycity•String
The name of the city, district, village, or town.
- Anchor to companycompany•String
The name of the customer's company or organization.
- Anchor to countryCodecountry•
Code CountryCode 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- Anchor to firstNamefirst•
Name String The first name of the customer.
- Anchor to lastNamelast•
Name String The last name of the customer.
- Anchor to latitudelatitude•Float
The approximate latitude of the address.
- Anchor to longitudelongitude•Float
The approximate longitude of the address.
- Anchor to namename•String
The full name of the customer, based on firstName and lastName.
- Anchor to phonephone•String
A unique phone number for the customer. Formatted using E.164 standard. For example, +16135551111.
- Anchor to provinceCodeprovince•
Code String The alphanumeric code for the region. For example, ON.
- •String
The zip or postal code of the address.
- Anchor to marketmarket•MarketDeprecated
- Anchor to handlehandle•Handle!non-null
A human-readable unique string for the market automatically generated from its title.
- •ID!non-null
A globally-unique identifier.
- Anchor to metafieldmetafield•Metafield
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.
- Anchor to namespacenamespace•String
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.
- •String!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.
Arguments
- Anchor to jsonValuejson•
Value JSON!non-null The data that's stored in the metafield, using JSON format.
- Anchor to typetype•String!non-null
The type of data that the metafield stores in the
valuefield.- Anchor to valuevalue•String!non-null
The data that's stored in the metafield. The data is always stored as a string, regardless of the metafield's type.
Fields
- Anchor to regionsregions•[Market
Region!]! non-null A geographic region which comprises a market.
- Anchor to namename•String
The name of the region in the language of the current localization.
- Anchor to deliveryOptionsdelivery•
Options [CartDelivery Option!]! 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.
- Anchor to codecode•String
A unique identifier that represents the delivery option offered to customers. For example,
Canada Post Expedited.- Anchor to costcost•Money
V2! non-null The amount that the customer pays if they select the delivery option.
- Anchor to amountamount•Decimal!non-null
A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.
- Anchor to currencyCodecurrency•
Code CurrencyCode! 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, USDC, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
- Anchor to deliveryMethodTypedelivery•
Method Type DeliveryMethod! 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- Anchor to descriptiondescription•String
A single-line description of the delivery option, with HTML tags removed.
- Anchor to handlehandle•Handle!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.- Anchor to titletitle•String
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.
- Anchor to discountAllocationsdiscount•
Allocations [DiscountAllocation!]! non-null The discounts that have been applied to the delivery group.
- Anchor to discountApplicationdiscount•
Application DiscountApplication! non-null The discount that was applied.
- Anchor to allocationMethodallocation•
Method DiscountApplication Allocation Method! non-null The method by which the discount's value is allocated to its entitled items.
ACROSS, EACH- Anchor to metafieldmetafield•Metafield
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.
- Anchor to namespacenamespace•String
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.
- •String!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.
Arguments
- Anchor to jsonValuejson•
Value JSON!non-null The data that's stored in the metafield, using JSON format.
- Anchor to typetype•String!non-null
The type of data that the metafield stores in the
valuefield.- Anchor to valuevalue•String!non-null
The data that's stored in the metafield. The data is always stored as a string, regardless of the metafield's type.
Fields
- Anchor to targetSelectiontarget•
Selection DiscountApplication Target Selection! non-null The lines on the cart targeted by the discount.
ALL, ENTITLED, EXPLICIT- Anchor to targetTypetarget•
Type DiscountApplication Target! non-null The type of line (i.e. line item or shipping line) on a cart that the discount is applicable towards.
LINE_ITEM, SHIPPING_LINE- Anchor to totalAllocatedAmounttotal•
Allocated Amount MoneyV2! non-null The total allocated amount of the discount across all items.
- Anchor to amountamount•Decimal!non-null
A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.
- Anchor to currencyCodecurrency•
Code CurrencyCode! 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, USDC, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
- Anchor to valuevalue•Pricing
Value! non-null The value of the discount.
- Anchor to MoneyV2•OBJECTMoney
V2 A precise monetary value and its associated currency. Combines a decimal amount with a three-letter currency code to express prices, costs, and other financial values throughout the API. For example, 12.99 USD.
- Anchor to amountamount•Decimal!non-null
A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.
- Anchor to currencyCodecurrency•
Code CurrencyCode! 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, USDC, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
- Anchor to PricingPercentageValue•OBJECTPricing
Percentage Value The percentage value of a discount.
- Anchor to valuevalue•Decimal!non-null
The percentage value of the discount.
- Anchor to discountedAmountdiscounted•
Amount MoneyV2! non-null The amount that was discounted.
- Anchor to amountamount•Decimal!non-null
A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.
- Anchor to currencyCodecurrency•
Code CurrencyCode! 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, USDC, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
- Anchor to groupTypegroup•
Type CartDelivery Group Type! non-null The type of merchandise in the delivery group.
ONE_TIME_PURCHASE, SUBSCRIPTION- •ID!non-null
A globally-unique ID for the delivery group.
- Anchor to selectedDeliveryOptionselected•
Delivery Option CartDelivery Option Information about the delivery option that the customer has selected.
- Anchor to codecode•String
A unique identifier that represents the delivery option offered to customers. For example,
Canada Post Expedited.- Anchor to costcost•Money
V2! non-null The amount that the customer pays if they select the delivery option.
- Anchor to amountamount•Decimal!non-null
A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.
- Anchor to currencyCodecurrency•
Code CurrencyCode! 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, USDC, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
- Anchor to deliveryMethodTypedelivery•
Method Type DeliveryMethod! 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- Anchor to descriptiondescription•String
A single-line description of the delivery option, with HTML tags removed.
- Anchor to handlehandle•Handle!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.- Anchor to titletitle•String
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.
- Anchor to discountApplicationsdiscount•
Applications [DiscountApplication!]! non-null The discounts that have been applied to the cart.
- Anchor to allocationMethodallocation•
Method DiscountApplication Allocation Method! non-null The method by which the discount's value is allocated to its entitled items.
ACROSS, EACH- Anchor to metafieldmetafield•Metafield
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.
- Anchor to namespacenamespace•String
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.
- •String!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.
Arguments
- Anchor to jsonValuejson•
Value JSON!non-null The data that's stored in the metafield, using JSON format.
- Anchor to typetype•String!non-null
The type of data that the metafield stores in the
valuefield.- Anchor to valuevalue•String!non-null
The data that's stored in the metafield. The data is always stored as a string, regardless of the metafield's type.
Fields
- Anchor to targetSelectiontarget•
Selection DiscountApplication Target Selection! non-null The lines on the cart targeted by the discount.
ALL, ENTITLED, EXPLICIT- Anchor to targetTypetarget•
Type DiscountApplication Target! non-null The type of line (i.e. line item or shipping line) on a cart that the discount is applicable towards.
LINE_ITEM, SHIPPING_LINE- Anchor to totalAllocatedAmounttotal•
Allocated Amount MoneyV2! non-null The total allocated amount of the discount across all items.
- Anchor to amountamount•Decimal!non-null
A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.
- Anchor to currencyCodecurrency•
Code CurrencyCode! 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, USDC, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
- Anchor to valuevalue•Pricing
Value! non-null The value of the discount.
- Anchor to MoneyV2•OBJECTMoney
V2 A precise monetary value and its associated currency. Combines a decimal amount with a three-letter currency code to express prices, costs, and other financial values throughout the API. For example, 12.99 USD.
- Anchor to amountamount•Decimal!non-null
A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.
- Anchor to currencyCodecurrency•
Code CurrencyCode! 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, USDC, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
- Anchor to PricingPercentageValue•OBJECTPricing
Percentage Value The percentage value of a discount.
- Anchor to valuevalue•Decimal!non-null
The percentage value of the discount.
- Anchor to lineslines•[Cart
Line!]! 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.
- Anchor to attributeattribute•Attribute
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
object in Liquid.- •String
The key of the cart attribute to retrieve. For example,
.
Arguments
- •String!non-null
The key or name of the attribute. For example,
.- Anchor to valuevalue•String
The value of the attribute. For example,
"true".
Fields
- •
- Anchor to costcost•Cart
Line Cost! 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.
- Anchor to amountPerQuantityamount•
Per Quantity MoneyV2! 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
is $10.- Anchor to amountamount•Decimal!non-null
A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.
- Anchor to currencyCodecurrency•
Code CurrencyCode! 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, USDC, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
- Anchor to compareAtAmountPerQuantitycompare•
At Amount Per Quantity MoneyV2 The
price 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'sis $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 isnullwhen the value is hidden from buyers.- Anchor to amountamount•Decimal!non-null
A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.
- Anchor to currencyCodecurrency•
Code CurrencyCode! 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, USDC, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
- Anchor to subtotalAmountsubtotal•
Amount MoneyV2! 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.
- Anchor to amountamount•Decimal!non-null
A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.
- Anchor to currencyCodecurrency•
Code CurrencyCode! 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, USDC, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
- Anchor to totalAmounttotal•
Amount MoneyV2! non-null The total cost of items in a cart.
- Anchor to amountamount•Decimal!non-null
A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.
- Anchor to currencyCodecurrency•
Code CurrencyCode! 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, USDC, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
- Anchor to discountAllocationsdiscount•
Allocations [DiscountAllocation!]! non-null The discounts that have been applied to the cart line.
- Anchor to discountApplicationdiscount•
Application DiscountApplication! non-null The discount that was applied.
- Anchor to allocationMethodallocation•
Method DiscountApplication Allocation Method! non-null The method by which the discount's value is allocated to its entitled items.
ACROSS, EACH- Anchor to metafieldmetafield•Metafield
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.
- Anchor to namespacenamespace•String
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.
- •String!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.
Arguments
- Anchor to jsonValuejson•
Value JSON!non-null The data that's stored in the metafield, using JSON format.
- Anchor to typetype•String!non-null
The type of data that the metafield stores in the
valuefield.- Anchor to valuevalue•String!non-null
The data that's stored in the metafield. The data is always stored as a string, regardless of the metafield's type.
Fields
- Anchor to targetSelectiontarget•
Selection DiscountApplication Target Selection! non-null The lines on the cart targeted by the discount.
ALL, ENTITLED, EXPLICIT- Anchor to targetTypetarget•
Type DiscountApplication Target! non-null The type of line (i.e. line item or shipping line) on a cart that the discount is applicable towards.
LINE_ITEM, SHIPPING_LINE- Anchor to totalAllocatedAmounttotal•
Allocated Amount MoneyV2! non-null The total allocated amount of the discount across all items.
- Anchor to amountamount•Decimal!non-null
A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.
- Anchor to currencyCodecurrency•
Code CurrencyCode! 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, USDC, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
- Anchor to valuevalue•Pricing
Value! non-null The value of the discount.
- Anchor to MoneyV2•OBJECTMoney
V2 A precise monetary value and its associated currency. Combines a decimal amount with a three-letter currency code to express prices, costs, and other financial values throughout the API. For example, 12.99 USD.
- Anchor to amountamount•Decimal!non-null
A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.
- Anchor to currencyCodecurrency•
Code CurrencyCode! 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, USDC, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
- Anchor to PricingPercentageValue•OBJECTPricing
Percentage Value The percentage value of a discount.
- Anchor to valuevalue•Decimal!non-null
The percentage value of the discount.
- Anchor to discountedAmountdiscounted•
Amount MoneyV2! non-null The amount that was discounted.
- Anchor to amountamount•Decimal!non-null
A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.
- Anchor to currencyCodecurrency•
Code CurrencyCode! 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, USDC, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
- •ID!non-null
The ID of the cart line.
- Anchor to merchandisemerchandise•Merchandise!non-null
The item that the customer intends to purchase.
- Anchor to CustomProduct•OBJECTCustom
Product 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.
- Anchor to isGiftCardis•
Gift Card Boolean!non-null Whether the merchandise is a gift card.
- Anchor to requiresShippingrequires•
Shipping Boolean!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.
- Anchor to titletitle•String!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.- Anchor to weightweight•Float
The product variant's weight, in the system of measurement set in the
field.- Anchor to weightUnitweight•
Unit WeightUnit! non-null The unit of measurement for weight.
GRAMS, KILOGRAMS, OUNCES, POUNDS
- Anchor to ProductVariant•OBJECTProduct
Variant 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.
- •ID!non-null
A globally-unique ID for the product variant.
- Anchor to metafieldmetafield•Metafield
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.
- Anchor to namespacenamespace•String
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.
- •String!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.
Arguments
- Anchor to jsonValuejson•
Value JSON!non-null The data that's stored in the metafield, using JSON format.
- Anchor to typetype•String!non-null
The type of data that the metafield stores in the
valuefield.- Anchor to valuevalue•String!non-null
The data that's stored in the metafield. The data is always stored as a string, regardless of the metafield's type.
Fields
- Anchor to productproduct•Product!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.
- Anchor to handlehandle•Handle!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 isblack-sunglasses.- Anchor to hasAnyTaghas•
Any Tag Boolean!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.- •[String!]!requiredDefault:[]
A comma-separated list of searchable keywords that are associated with the product. For example,
"sports, summer"returns products with either thesportsorsummertag.
Arguments
- •
- Anchor to hasTagshas•
Tags [HasTag Response!]! non-null Whether the product is associated with the specified tags.
- •[String!]!requiredDefault:[]
A comma-separated list of searchable keywords that are associated with the product. For example,
"sports, summer"returns products with both thesportsandsummertags.
Arguments
- Anchor to hasTaghas•
Tag Boolean!non-null Whether the Shopify resource has the tag.
- •String!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
sportsandsummertags to products that are associated with sportswear for summer.
Fields
- •
- •ID!non-null
A globally-unique ID for the product.
- Anchor to inAnyCollectionin•
Any Collection Boolean!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.
- •[ID!]!requiredDefault:[]
A comma-separated list of globally-unique collection IDs that are associated with the product. For example,
,.
Arguments
- •
- Anchor to inCollectionsin•
Collections [CollectionMembership!]! 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.
- •[ID!]!requiredDefault:[]
A comma-separated list of globally-unique collection IDs that are associated with the product. For example,
,.
Arguments
- Anchor to collectionIdcollection•
Id ID!non-null A globally-unique ID for the collection.
- Anchor to isMemberis•
Member Boolean!non-null Whether the product is in the specified collection.
Fields
- •
- Anchor to isGiftCardis•
Gift Card Boolean!non-null Whether the product is a gift card.
- Anchor to metafieldmetafield•Metafield
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.
- Anchor to namespacenamespace•String
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.
- •String!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.
Arguments
- Anchor to jsonValuejson•
Value JSON!non-null The data that's stored in the metafield, using JSON format.
- Anchor to typetype•String!non-null
The type of data that the metafield stores in the
valuefield.- Anchor to valuevalue•String!non-null
The data that's stored in the metafield. The data is always stored as a string, regardless of the metafield's type.
Fields
- Anchor to productTypeproduct•
Type String A custom category for a product. Product types allow merchants to define categories other than the ones available in Shopify's standard product categories.
- Anchor to titletitle•String!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.- Anchor to vendorvendor•String
The name of the product's vendor.
- Anchor to requiresShippingrequires•
Shipping Boolean!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.
- •String
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.- Anchor to titletitle•String
The localized name for the product variant that displays to customers.
- Anchor to weightweight•Float
The product variant's weight, in the system of measurement set in the
field.- Anchor to weightUnitweight•
Unit WeightUnit! non-null The unit of measurement for weight.
GRAMS, KILOGRAMS, OUNCES, POUNDS
- •
- Anchor to parentRelationshipparent•
Relationship CartLine Parent Relationship The nested relationship between this line and its parent line, if any.
- Anchor to parentparent•Cart
Line! non-null The parent line in the relationship.
- Anchor to quantityquantity•Int!non-null
The quantity of the item that the customer intends to purchase.
- Anchor to sellingPlanAllocationselling•
Plan Allocation SellingPlan Allocation The selling plan associated with the cart line, including information about how a product variant can be sold and purchased.
- Anchor to priceAdjustmentsprice•
Adjustments [SellingPlan Allocation Price Adjustment!]! 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.
- Anchor to perDeliveryPriceper•
Delivery Price MoneyV2! 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.
- Anchor to amountamount•Decimal!non-null
A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.
- Anchor to currencyCodecurrency•
Code CurrencyCode! 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, USDC, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
- Anchor to priceprice•Money
V2! 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.
- Anchor to amountamount•Decimal!non-null
A monetary value in decimal format, allowing for precise representation of cents or fractional currency. For example, 12.99.
- Anchor to currencyCodecurrency•
Code CurrencyCode! 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, USDC, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XXX, YER, ZAR, ZMW, BYR, STD, VEF
- Anchor to sellingPlanselling•
Plan SellingPlan! 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'.
- Anchor to descriptiondescription•String
The description of the selling plan.
- •ID!non-null
A globally-unique identifier.
- Anchor to metafieldmetafield•Metafield
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.
- Anchor to namespacenamespace•String
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.
- •String!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.
Arguments
- Anchor to jsonValuejson•
Value JSON!non-null The data that's stored in the metafield, using JSON format.
- Anchor to typetype•String!non-null
The type of data that the metafield stores in the
valuefield.- Anchor to valuevalue•String!non-null
The data that's stored in the metafield. The data is always stored as a string, regardless of the metafield's type.
Fields
- Anchor to namename•String!non-null
The name of the selling plan. For example, '6 weeks of prepaid granola, delivered weekly'.
- Anchor to recurringDeliveriesrecurring•
Deliveries Boolean!non-null Whether purchasing the selling plan will result in multiple deliveries.
- Anchor to localizedFieldslocalized•
Fields [LocalizedField!]! 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.
- Anchor to keyskeys•[Localized
Field Key!]! requiredDefault:[] 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
Arguments
- •Localized
Field Key! 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- Anchor to titletitle•String!non-null
The title of the localized field.
- Anchor to valuevalue•String
The value of the localized field.
Fields
- Anchor to metafieldmetafield•Metafield
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.
- Anchor to namespacenamespace•String
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.
- •String!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.
Arguments
- Anchor to jsonValuejson•
Value JSON!non-null The data that's stored in the metafield, using JSON format.
- Anchor to typetype•String!non-null
The type of data that the metafield stores in the
valuefield.- Anchor to valuevalue•String!non-null
The data that's stored in the metafield. The data is always stored as a string, regardless of the metafield's type.
Fields
- Anchor to poNumberpo•
Number String A purchase order number associated with the cart, often used for B2B transactions to reference the buyer's internal purchase order.
- Anchor to retailLocationretail•
Location Location The physical location where a retail order is created or completed.
- Anchor to addressaddress•Location
Address! non-null The address of this location.
- Anchor to address1address1•String
The first line of the address for the location.
- Anchor to address2address2•String
The second line of the address for the location.
- Anchor to citycity•String
The city of the location.
- Anchor to countrycountry•String
The country of the location.
- Anchor to countryCodecountry•
Code String The country code of the location.
- Anchor to formattedformatted•[String!]!non-null
A formatted version of the address for the location.
- Anchor to latitudelatitude•Float
The approximate latitude coordinates of the location.
- Anchor to longitudelongitude•Float
The approximate longitude coordinates of the location.
- Anchor to phonephone•String
The phone number of the location.
- Anchor to provinceprovince•String
The province of the location.
- Anchor to provinceCodeprovince•
Code String The code for the province, state, or district of the address of the location.
- •String
The ZIP code of the location.
- Anchor to handlehandle•Handle!non-null
The location handle.
- •ID!non-null
The location id.
- Anchor to metafieldmetafield•Metafield
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.
- Anchor to namespacenamespace•String
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.
- •String!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.
Arguments
- Anchor to jsonValuejson•
Value JSON!non-null The data that's stored in the metafield, using JSON format.
- Anchor to typetype•String!non-null
The type of data that the metafield stores in the
valuefield.- Anchor to valuevalue•String!non-null
The data that's stored in the metafield. The data is always stored as a string, regardless of the metafield's type.
Fields
- Anchor to namename•String!non-null
The name of the location.
- Anchor to localizationlocalization•Localization!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.
- Anchor to countrycountry•Country!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.
- Anchor to isoCodeiso•
Code CountryCode! 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
- Anchor to languagelanguage•Language!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.
- Anchor to isoCodeiso•
Code LanguageCode! 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
- Anchor to marketmarket•Market!non-nullDeprecated
- Anchor to handlehandle•Handle!non-null
A human-readable unique string for the market automatically generated from its title.
- •ID!non-null
A globally-unique identifier.
- Anchor to metafieldmetafield•Metafield
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.
- Anchor to namespacenamespace•String
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.
- •String!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.
Arguments
- Anchor to jsonValuejson•
Value JSON!non-null The data that's stored in the metafield, using JSON format.
- Anchor to typetype•String!non-null
The type of data that the metafield stores in the
valuefield.- Anchor to valuevalue•String!non-null
The data that's stored in the metafield. The data is always stored as a string, regardless of the metafield's type.
Fields
- Anchor to regionsregions•[Market
Region!]! non-null A geographic region which comprises a market.
- Anchor to namename•String
The name of the region in the language of the current localization.
- Anchor to paymentCustomizationpayment•
Customization PaymentCustomization! non-null The configuration of the app that owns the Function. This configuration controls how merchants can modify payment methods, such as renaming, reordering, or hiding them.
- Anchor to metafieldmetafield•Metafield
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.
- Anchor to namespacenamespace•String
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.
- •String!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.
Arguments
- Anchor to jsonValuejson•
Value JSON!non-null The data that's stored in the metafield, using JSON format.
- Anchor to typetype•String!non-null
The type of data that the metafield stores in the
valuefield.- Anchor to valuevalue•String!non-null
The data that's stored in the metafield. The data is always stored as a string, regardless of the metafield's type.
Fields
- Anchor to paymentMethodspayment•
Methods [PaymentCustomization Payment Method!]! non-null The list of payment methods that are available to customers during checkout that your Function can customize.
- •ID!non-null
Unique identifier for the payment method.
- Anchor to namename•String!non-null
Name for the payment method.
- Anchor to placementsplacements•[Payment
Customization Payment Method Placement!]! non-null Placements supported by this payment method. Only available for API clients installed on a Shopify Plus store.
ACCELERATED_CHECKOUT, PAYMENT_METHOD
- •
- Anchor to presentmentCurrencyRatepresentment•
Currency Rate Decimal!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.
- Anchor to shopshop•Shop!non-null
Information about the shop where the Function is running, including the shop's timezone setting and associated metafields.
- Anchor to localTimelocal•
Time LocalTime! non-null The current time based on the store's timezone setting.
- Anchor to datedate•Date!non-null
The current date relative to the parent object.
- Anchor to dateTimeAfterdate•
Time After Boolean!non-null Returns true if the current date and time is at or past the given date and time, and false otherwise.
- Anchor to dateTimedate•
Time DateTime Without Timezone! required The date and time to compare against, assumed to be in the timezone of the parent object.
Arguments
- Anchor to dateTimeBeforedate•
Time Before Boolean!non-null Returns true if the current date and time is before the given date and time, and false otherwise.
- Anchor to dateTimedate•
Time DateTime Without Timezone! required The date and time to compare against, assumed to be in the timezone of the parent timezone.
Arguments
- Anchor to dateTimeBetweendate•
Time Between Boolean!non-null Returns true if the current date and time is between the two given date and times, and false otherwise.
- Anchor to startDateTimestart•
Date Time DateTime Without Timezone! required The lower bound time to compare against, assumed to be in the timezone of the parent timezone.
- Anchor to endDateTimeend•
Date Time DateTime Without Timezone! required The upper bound time to compare against, assumed to be in the timezone of the parent timezone.
Arguments
- Anchor to timeAftertime•
After Boolean!non-null Returns true if the current time is at or past the given time, and false otherwise.
- Anchor to timetime•Time
Without Timezone! required The time to compare against, assumed to be in the timezone of the parent timezone.
Arguments
- Anchor to timeBeforetime•
Before Boolean!non-null Returns true if the current time is at or past the given time, and false otherwise.
- Anchor to timetime•Time
Without Timezone! required The time to compare against, assumed to be in the timezone of the parent timezone.
Arguments
- Anchor to timeBetweentime•
Between Boolean!non-null Returns true if the current time is between the two given times, and false otherwise.
- Anchor to startTimestart•
Time TimeWithout Timezone! required The lower bound time to compare against, assumed to be in the timezone of the parent timezone.
- Anchor to endTimeend•
Time TimeWithout Timezone! required The upper bound time to compare against, assumed to be in the timezone of the parent timezone.
Arguments
- Anchor to metafieldmetafield•Metafield
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.
- Anchor to namespacenamespace•String
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.
- •String!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.
Arguments
- Anchor to jsonValuejson•
Value JSON!non-null The data that's stored in the metafield, using JSON format.
- Anchor to typetype•String!non-null
The type of data that the metafield stores in the
valuefield.- Anchor to valuevalue•String!non-null
The data that's stored in the metafield. The data is always stored as a string, regardless of the metafield's type.
Fields
- Anchor to metaobjectmetaobject•Metaobject
Fetch a specific Metaobject by one of its unique identifiers. Only app-owned metaobjects with the $app reserved prefix are accessible to functions.
- Anchor to handlehandle•Metaobject
Handle Input The handle and type of the metaobject.
- Anchor to handlehandle•String!non-null
The handle of the metaobject to retrieve.
- Anchor to typetype•String!non-null
The type of the metaobject. Must match an existing metaobject definition type.
- •ID
The ID of the metaobject.
Arguments
- Anchor to fieldfield•Metaobject
Field The field for an object key, or null if the key has no field definition.
- •String!required
The metaobject key to access.
Arguments
- Anchor to jsonValuejson•
Value JSON The assigned field value in JSON format.
- •String!non-null
The object key of this field.
- Anchor to typetype•String!non-null
The type of the field.
- Anchor to valuevalue•String
The assigned field value, always stored as a string regardless of the field type.
Fields
- •
- Anchor to handlehandle•String!non-null
The unique handle of the metaobject, useful as a custom ID.
- Anchor to typetype•String!non-null
The type of the metaobject.
Fields
Anchor to Run functionRun function
The logic that processes the input data to generate a standardized list of operations that generate payment method customizations, payment terms, and review requirements.
Each operation specifies a payment customization. Shopify processes your response to modify payment methods, set payment terms, and add a review requirement during checkout, including data such as location details, the company associated with the order, and products.
This return must follow the schema defined in the CartPaymentMethodsTransformRunResult object.
- CartPaymentMethodsTransformRunResult
- OBJECT
The
CartPaymentMethodsTransformRunResultobject is the output of the function run target. The object contains the operations to apply to payment methods in checkout.- Anchor to operationsoperations•[Operation!]!non-null
The ordered list of operations to apply to the list of payment methods.
- Anchor to orderReviewAddorder•
Review Add OrderReview Add Operation A request to impose a review requirement on the order.
When your Function returns this operation, the checkout will be submitted as a draft, requiring merchant review and approval to finalize the order.
Use this operation to implement custom business rules that require manual review before order completion, such as high-value orders, or orders with specific products.
This operation is only available for B2B purchases on stores with the Plus plan.
- Anchor to reasonreason•String!non-null
The reason for the review requirement presented to the merchant.
- Anchor to paymentMethodHidepayment•
Method Hide PaymentMethod Hide Operation A request to hide a payment method during checkout.
When your Function returns this operation, it removes the specified payment method from the available options shown to customers during checkout.
Use this operation when you want to conditionally hide payment methods based on checkout attributes, customer data, or other business logic implemented in your Function.
- Anchor to paymentMethodIdpayment•
Method Id ID!non-null The identifier of the payment method to hide out.
- Anchor to placementsplacements•[Payment
Customization Payment Method Placement!] Placement types to hide. If not provided, all placements will be hidden.
ACCELERATED_CHECKOUT, PAYMENT_METHOD
- Anchor to paymentMethodMovepayment•
Method Move PaymentMethod Move Operation A request to move a payment method to a new position in the checkout display order.
When your Function returns this operation, it changes the display order of payment methods by placing the specified payment method at the requested index position.
Use this operation when you want to prioritize certain payment methods based on checkout context, customer preferences, or other business logic implemented in your Function.
- Anchor to indexindex•Int!non-null
The index to move the payment method to.
- Anchor to paymentMethodIdpayment•
Method Id ID!non-null The identifier of the payment method to move.
- Anchor to paymentMethodRenamepayment•
Method Rename PaymentMethod Rename Operation A request to change the displayed name of a payment method during checkout.
When your Function returns this operation, it replaces the default name of the specified payment method with the custom name that's provided in the request.
Use this operation when you want to provide more context or clarity about payment methods based on checkout details, locale, or other business logic implemented in your Function.
- Anchor to namename•String!non-null
The new name for the payment method.
- Anchor to paymentMethodIdpayment•
Method Id ID!non-null The identifier of the payment method to rename.
- Anchor to paymentTermsSetpayment•
Terms Set PaymentTerms Set Operation A request to set, modify, or remove payment terms for a checkout.
When your Function returns this operation, it customizes the payment conditions presented to the customer at checkout, allowing for net terms, fixed due dates, and event-based terms. You can also specify deposit requirements.
Use this operation to conditionally impose payment terms based on customer attributes, order value, or other business logic.
This operation is only available on stores with the Plus plan.
- Anchor to paymentTermspayment•
Terms PaymentTerms The payment terms to set. No payment terms when nil
- Anchor to eventevent•Event
Payment Terms The input to set event-based payment terms.
- Anchor to depositdeposit•Deposit
The deposit for payment terms. No deposit by default.
- Anchor to percentagepercentage•Float!non-null
The percentage of the order total that should be paid as a deposit. Must be between 1 and 99, inclusive.
- Anchor to triggertrigger•Payment
Terms Trigger Event! non-null The event that triggers the payment terms.
FULFILLMENT_CREATED, INVOICE_SENT, ORDER_FULFILLED
- Anchor to fixedfixed•Fixed
Payment Terms The input to set fixed payment terms.
- Anchor to depositdeposit•Deposit
The deposit for payment terms. No deposit by default.
- Anchor to percentagepercentage•Float!non-null
The percentage of the order total that should be paid as a deposit. Must be between 1 and 99, inclusive.
- Anchor to dueAtdue•
At DateTime! non-null The due date for fixed payment terms.
- •Net
Payment Terms The input to set net payment terms.
- Anchor to depositdeposit•Deposit
The deposit for payment terms. No deposit by default.
- Anchor to percentagepercentage•Float!non-null
The percentage of the order total that should be paid as a deposit. Must be between 1 and 99, inclusive.
- Anchor to dueInDaysdue•
In Days Int!non-null The number of days until the payment is due. Currently supported values are restricted to 7, 15, 30, 45, 60, and 90. These values may change in the future as restrictions are lifted, but existing values will continue to be supported.
- Anchor to issuedAtissued•
At DateTime The issued date of net payment terms. Set to current time if nil.
Reorder payment methods
This function reorders payment methods based on a configurable desired order that is stored in an app metafield.cart.payment-methods.transform.run
Input Query (Rust)
query Input { paymentMethods { id name } paymentCustomization { metafield(namespace: "$app:payment-customization", key: "configuration") { jsonValue } } }Input Query (JavaScript)
query CartPaymentMethodsTransformRunInput { paymentMethods { id name } paymentCustomization { metafield(namespace: "$app:payment-customization", key: "configuration") { jsonValue } } }Input Object (Rust)
{ "paymentMethods": [ { "id": "gid://shopify/PaymentCustomizationPaymentMethod/1", "name": "Money Order" }, { "id": "gid://shopify/PaymentCustomizationPaymentMethod/2", "name": "Shopify Payments" }, { "id": "gid://shopify/PaymentCustomizationPaymentMethod/3", "name": "Cash on Delivery (COD)" } ], "paymentCustomization": { "metafield": { "jsonValue": { "payment_methods": [ "Money Order", "Shopify Payments", "Cash on Delivery (COD)" ] } } } }Input Object (JavaScript)
{ "paymentMethods": [ { "id": "gid://shopify/PaymentCustomizationPaymentMethod/1", "name": "Money Order" }, { "id": "gid://shopify/PaymentCustomizationPaymentMethod/2", "name": "Shopify Payments" }, { "id": "gid://shopify/PaymentCustomizationPaymentMethod/3", "name": "Cash on Delivery (COD)" } ], "paymentCustomization": { "metafield": { "jsonValue": { "payment_methods": [ "Money Order", "Shopify Payments", "Cash on Delivery (COD)" ] } } } }Function Code (Rust)
use crate::schema; use shopify_function::prelude::*; use shopify_function::Result; #[derive(Deserialize, Default, PartialEq)] pub struct Configuration { payment_methods: Vec<String>, } #[shopify_function] fn cart_payment_methods_transform_run(input: schema::run::Input) -> Result<schema::CartPaymentMethodsTransformRunResult> { let config: &Configuration = match input.payment_customization().metafield() { Some(metafield) => metafield.json_value(), None => return Ok(schema::CartPaymentMethodsTransformRunResult { operations: vec![] }), }; let mut operations = vec![]; for (index, method_name) in config.payment_methods.iter().enumerate() { if let Some(method) = input.payment_methods().iter().find(|m| m.name() == method_name) { operations.push(schema::Operation::PaymentMethodMove(schema::PaymentMethodMoveOperation { payment_method_id: method.id().to_string(), index: index as i32, })); } } Ok(schema::CartPaymentMethodsTransformRunResult { operations }) }Performance Cost (Rust)
44481 instructions
Function Code (JavaScript)
// @ts-check /** * @typedef {import("../generated/api").CartPaymentMethodsTransformRunInput} CartPaymentMethodsTransformRunInput * @typedef {import("../generated/api").CartPaymentMethodsTransformRunResult} CartPaymentMethodsTransformRunResult */ /** * @param {CartPaymentMethodsTransformRunInput} input * @returns {CartPaymentMethodsTransformRunResult} */ export function cartPaymentMethodsTransformRun(input) { // Parse configuration from metafield, defaulting to empty payment_methods array const configuration = { payment_methods: [], ...(input.paymentCustomization.metafield?.jsonValue ?? {}) }; const operations = []; // Create move operations for each configured payment method configuration.payment_methods.forEach((methodName, index) => { const method = input.paymentMethods?.find(paymentMethod => paymentMethod.name === methodName); if (method) { operations.push({ paymentMethodMove: { paymentMethodId: method.id, index } }); } }); return { operations }; }Performance Cost (JavaScript)
252136 instructions
Output JSON (Rust)
{ "operations": [ { "paymentMethodMove": { "index": 0, "paymentMethodId": "gid://shopify/PaymentCustomizationPaymentMethod/1" } }, { "paymentMethodMove": { "index": 1, "paymentMethodId": "gid://shopify/PaymentCustomizationPaymentMethod/2" } }, { "paymentMethodMove": { "index": 2, "paymentMethodId": "gid://shopify/PaymentCustomizationPaymentMethod/3" } } ] }Output JSON (JavaScript)
{ "operations": [ { "paymentMethodMove": { "index": 0, "paymentMethodId": "gid://shopify/PaymentCustomizationPaymentMethod/1" } }, { "paymentMethodMove": { "index": 1, "paymentMethodId": "gid://shopify/PaymentCustomizationPaymentMethod/2" } }, { "paymentMethodMove": { "index": 2, "paymentMethodId": "gid://shopify/PaymentCustomizationPaymentMethod/3" } } ] }Rename payment methods
This function renames payment methods based on a configurable list of payment method names that is stored in an app owned metafield.cart.payment-methods.transform.run
Input Query (Rust)
query Input { paymentMethods { id name } paymentCustomization { metafield(namespace: "$app:payment-customization", key: "configuration") { jsonValue } } }Input Query (JavaScript)
query CartPaymentMethodsTransformRunInput { paymentMethods { id name } paymentCustomization { metafield(namespace: "$app:payment-customization", key: "configuration") { jsonValue } } }Input Object (Rust)
{ "paymentMethods": [ { "id": "gid://shopify/PaymentCustomizationPaymentMethod/1", "name": "Credit Card" }, { "id": "gid://shopify/PaymentCustomizationPaymentMethod/2", "name": "PayPal" } ], "paymentCustomization": { "metafield": { "jsonValue": { "renameMap": { "Credit Card": "Visa/MasterCard", "PayPal": "PayPal Express" } } } } }Input Object (JavaScript)
{ "paymentMethods": [ { "id": "gid://shopify/PaymentCustomizationPaymentMethod/1", "name": "Credit Card" }, { "id": "gid://shopify/PaymentCustomizationPaymentMethod/2", "name": "PayPal" } ], "paymentCustomization": { "metafield": { "jsonValue": { "Credit Card": "Visa/MasterCard", "PayPal": "PayPal Express" } } } }Function Code (Rust)
use std::collections::HashMap; use crate::schema; use shopify_function::prelude::*; use shopify_function::Result; #[derive(Deserialize, Default, PartialEq)] #[shopify_function(rename_all = "camelCase")] pub struct RenameConfiguration { rename_map: HashMap<String, String>, } #[shopify_function] fn cart_payment_methods_transform_run(input: schema::run::Input) -> Result<schema::CartPaymentMethodsTransformRunResult> { // Extract configuration from metafield let config: &RenameConfiguration = match input.payment_customization().metafield() { Some(metafield) => metafield.json_value(), None => return Ok(schema::CartPaymentMethodsTransformRunResult { operations: vec![] }), }; // Convert to case-insensitive map let rename_map: HashMap<String, String> = config.rename_map.clone() .into_iter() .map(|(k, v)| (k.to_ascii_lowercase(), v)) .collect(); // Create rename operations based on the configuration, using case-insensitive comparison let operations: Vec<schema::Operation> = input.payment_methods() .iter() .filter_map(|method| { rename_map.get(&method.name().to_ascii_lowercase()).map(|new_name| { schema::Operation::PaymentMethodRename(schema::PaymentMethodRenameOperation { payment_method_id: method.id().to_string(), name: new_name.clone(), }) }) }) .collect(); Ok(schema::CartPaymentMethodsTransformRunResult { operations }) }Performance Cost (Rust)
49642 instructions
Function Code (JavaScript)
// @ts-check /** * @typedef {import("../generated/api").CartPaymentMethodsTransformRunInput} CartPaymentMethodsTransformRunInput * @typedef {import("../generated/api").CartPaymentMethodsTransformRunResult} CartPaymentMethodsTransformRunResult * @typedef {import("../generated/api").Operation} Operation */ /** * @type {CartPaymentMethodsTransformRunResult} */ const NO_CHANGES = { operations: [], }; /** * @param {CartPaymentMethodsTransformRunInput} input * @returns {CartPaymentMethodsTransformRunResult} */ export function cartPaymentMethodsTransformRun(input) { // Extract configuration from metafield and convert keys to lowercase const rawRenameMap = input.paymentCustomization.metafield?.jsonValue ?? {}; const renameMap = Object.entries(rawRenameMap).reduce((acc, [key, value]) => { acc[key.toLowerCase()] = value; return acc; }, {}); if (!input.paymentMethods || Object.keys(renameMap).length === 0) { return NO_CHANGES; } // Create rename operations based on the configuration, using case-insensitive comparison const operations = input.paymentMethods .filter(method => renameMap[method.name.toLowerCase()]) .map(method => ({ paymentMethodRename: { paymentMethodId: method.id, name: renameMap[method.name.toLowerCase()] } })); return { operations }; }Performance Cost (JavaScript)
273553 instructions
Output JSON (Rust)
{ "operations": [ { "paymentMethodRename": { "name": "Visa/MasterCard", "paymentMethodId": "gid://shopify/PaymentCustomizationPaymentMethod/1" } }, { "paymentMethodRename": { "name": "PayPal Express", "paymentMethodId": "gid://shopify/PaymentCustomizationPaymentMethod/2" } } ] }Output JSON (JavaScript)
{ "operations": [ { "paymentMethodRename": { "name": "Visa/MasterCard", "paymentMethodId": "gid://shopify/PaymentCustomizationPaymentMethod/1" } }, { "paymentMethodRename": { "name": "PayPal Express", "paymentMethodId": "gid://shopify/PaymentCustomizationPaymentMethod/2" } } ] }Hide payment methods based on customer tags
This function hides a configurable payment method for customers without a specific tag. The configuration is stored in an app owned metafield and can configure multiple tags.cart.payment-methods.transform.run
Input Query (Rust)
query Input($tags_list: [String!]! = ["VIP", "WHOLESALE"]) { cart { buyerIdentity { customer { hasTags(tags: $tags_list) { hasTag tag } } } } paymentCustomization { metafield(namespace: "$app:payment_customization", key: "configuration") { jsonValue } } paymentMethods { id name } }Input Query (JavaScript)
query CartPaymentMethodsTransformRunInput($tags_list: [String!]! = ["VIP", "WHOLESALE"]) { cart { buyerIdentity { customer { hasTags(tags: $tags_list) { hasTag tag } } } } paymentCustomization { metafield(namespace: "$app:payment_customization", key: "configuration") { jsonValue } } paymentMethods { id name } }Input Object (Rust)
{ "cart": { "buyerIdentity": { "customer": { "hasTags": [ { "tag": "VIP", "hasTag": false }, { "tag": "Wholesale", "hasTag": true } ] } } }, "paymentCustomization": { "metafield": { "jsonValue": { "payment_methods": { "VIP": [ "Cash on Delivery" ], "Wholesale": [ "Net 30" ] } } } }, "paymentMethods": [ { "id": "gid://shopify/PaymentCustomizationPaymentMethod/1", "name": "Cash on Delivery" }, { "id": "gid://shopify/PaymentCustomizationPaymentMethod/2", "name": "Net 30" } ] }Input Object (JavaScript)
{ "cart": { "buyerIdentity": { "customer": { "hasTags": [ { "tag": "VIP", "hasTag": false }, { "tag": "Wholesale", "hasTag": true } ] } } }, "paymentCustomization": { "metafield": { "jsonValue": { "payment_methods": { "VIP": [ "Cash on Delivery" ], "Wholesale": [ "Net 30" ] } } } }, "paymentMethods": [ { "id": "gid://shopify/PaymentCustomizationPaymentMethod/1", "name": "Cash on Delivery" }, { "id": "gid://shopify/PaymentCustomizationPaymentMethod/2", "name": "Net 30" } ] }Function Code (Rust)
use crate::schema; use shopify_function::prelude::*; use shopify_function::Result; use std::collections::HashMap; #[derive(Deserialize, Default, PartialEq)] pub struct PaymentRules { payment_methods: HashMap<String, Vec<String>>, } #[shopify_function] fn cart_payment_methods_transform_run(input: schema::run::Input) -> Result<schema::CartPaymentMethodsTransformRunResult> { let customer_tags = input .cart() .buyer_identity() .and_then(|identity| identity.customer()) .map(|customer| { customer .has_tags() .iter() .filter(|tag| *tag.has_tag()) .map(|tag| tag.tag().to_string()) .collect::<Vec<String>>() }) .unwrap_or_default(); let payment_rules: &PaymentRules = match input.payment_customization().metafield() { Some(metafield) => metafield.json_value(), None => return Ok(schema::CartPaymentMethodsTransformRunResult { operations: vec![] }), }; let mut operations = vec![]; for method in input.payment_methods() { let mut should_hide = true; // Check if this payment method is allowed for any of the customer's tags for tag in &customer_tags { if let Some(allowed_methods) = payment_rules.payment_methods.get(tag) { if allowed_methods.contains(&method.name()) { should_hide = false; break; } } } if should_hide { operations.push(schema::Operation::PaymentMethodHide(schema::PaymentMethodHideOperation { payment_method_id: method.id().to_string(), placements: None, })); } } Ok(schema::CartPaymentMethodsTransformRunResult { operations }) }Performance Cost (Rust)
53722 instructions
Function Code (JavaScript)
// @ts-check /** * @typedef {import("../generated/api").CartPaymentMethodsTransformRunInput} CartPaymentMethodsTransformRunInput * @typedef {import("../generated/api").CartPaymentMethodsTransformRunResult} CartPaymentMethodsTransformRunResult */ /** * @type {CartPaymentMethodsTransformRunResult} */ const NO_CHANGES = { operations: [], }; /** * @param {CartPaymentMethodsTransformRunInput} input * @returns {CartPaymentMethodsTransformRunResult} */ export function cartPaymentMethodsTransformRun(input) { // Get customer tags that are true const customerTags = input?.cart?.buyerIdentity?.customer?.hasTags ?.filter(tag => tag.hasTag) .map(tag => tag.tag) || []; // Get payment rules from metafield const paymentRules = input?.paymentCustomization?.metafield?.jsonValue?.payment_methods || {}; if (!input.paymentMethods) { return NO_CHANGES; } const operations = []; // Check each payment method for (const method of input.paymentMethods) { let shouldHide = true; // Check if this payment method is allowed for any of the customer's tags for (const tag of customerTags) { const allowedMethods = paymentRules[tag] || []; if (allowedMethods.includes(method.name)) { shouldHide = false; break; } } if (shouldHide) { operations.push({ paymentMethodHide: { paymentMethodId: method.id } }); } } return { operations }; }Performance Cost (JavaScript)
260275 instructions
Output JSON (Rust)
{ "operations": [ { "paymentMethodHide": { "paymentMethodId": "gid://shopify/PaymentCustomizationPaymentMethod/1", "placements": null } } ] }Output JSON (JavaScript)
{ "operations": [ { "paymentMethodHide": { "paymentMethodId": "gid://shopify/PaymentCustomizationPaymentMethod/1" } } ] }Hide payment methods for small orders
This example implements a Shopify function that hides certain payment methods when the cart total is below a threshold amount.cart.payment-methods.transform.run
Input Query (Rust)
query Input { cart { cost { totalAmount { amount } } } paymentMethods { id name } paymentCustomization { metafield(namespace: "$app:payment-customization", key: "function-configuration") { jsonValue } } }Input Query (JavaScript)
query CartPaymentMethodsTransformRunInput { cart { cost { totalAmount { amount } } } paymentMethods { id name } paymentCustomization { metafield(namespace: "$app:payment-customization", key: "function-configuration") { jsonValue } } }Input Object (Rust)
{ "cart": { "cost": { "totalAmount": { "amount": "50.00" } } }, "paymentMethods": [ { "id": "pm_1", "name": "Credit Card" } ], "paymentCustomization": { "metafield": { "jsonValue": { "minimum_amount": 100.0, "payment_method_ids": [ "pm_1" ] } } } }Input Object (JavaScript)
{ "cart": { "cost": { "totalAmount": { "amount": "50.00" } } }, "paymentMethods": [ { "id": "pm_1", "name": "Credit Card" } ], "paymentCustomization": { "metafield": { "jsonValue": { "minimum_amount": 100.0, "payment_method_ids": [ "pm_1" ] } } } }Function Code (Rust)
use crate::schema; use shopify_function::prelude::*; use shopify_function::Result; #[derive(Deserialize, Default, PartialEq)] pub struct Configuration { minimum_amount: f64, payment_method_ids: Vec<String>, } #[shopify_function] fn cart_payment_methods_transform_run(input: schema::run::Input) -> Result<schema::CartPaymentMethodsTransformRunResult> { // Get configuration or return empty result if no metafield is set let config: &Configuration= match input.payment_customization().metafield() { Some(metafield) => metafield.json_value(), None => return Ok(schema::CartPaymentMethodsTransformRunResult { operations: vec![] }), }; let cart_total = input.cart().cost().total_amount().amount().0; // If cart total is below minimum, hide specified payment methods if cart_total < config.minimum_amount { let payment_methods: std::collections::HashSet<String> = input.payment_methods() .into_iter() .map(|method| method.id().to_string()) .collect(); let operations = config.payment_method_ids .iter() .filter(|id| payment_methods.contains(*id)) .map(|id| { schema::Operation::PaymentMethodHide(schema::PaymentMethodHideOperation { payment_method_id: id.clone(), placements: None, }) }) .collect(); return Ok(schema::CartPaymentMethodsTransformRunResult { operations }); } Ok(schema::CartPaymentMethodsTransformRunResult { operations: vec![] }) }Performance Cost (Rust)
34975 instructions
Function Code (JavaScript)
// @ts-check /** * @typedef {import("../generated/api").CartPaymentMethodsTransformRunInput} CartPaymentMethodsTransformRunInput * @typedef {import("../generated/api").CartPaymentMethodsTransformRunResult} CartPaymentMethodsTransformRunResult * @typedef {import("../generated/api").Operation} Operation * @typedef {import("../generated/api").PaymentMethodHideOperation} PaymentMethodHideOperation * * @typedef {Object} Configuration * @property {number} minimum_amount - The minimum cart amount threshold * @property {string[]} payment_method_ids - Array of payment method IDs to hide */ /** * @param {CartPaymentMethodsTransformRunInput} input - The function input containing cart and configuration data * @returns {CartPaymentMethodsTransformRunResult} The function result containing operations */ export function cartPaymentMethodsTransformRun(input) { // Get configuration from metafield /** @type {Configuration} */ const configuration = input.paymentCustomization.metafield?.jsonValue ?? {}; if (!configuration.minimum_amount || !configuration.payment_method_ids) { return { operations: [] }; } const cartTotal = parseFloat(input.cart.cost.totalAmount.amount); // If cart total is below minimum, hide specified payment methods if (cartTotal < configuration.minimum_amount) { /** @type {Operation[]} */ const operations = []; for (let i = 0; i < configuration.payment_method_ids.length; i++) { operations.push({ paymentMethodHide: { paymentMethodId: configuration.payment_method_ids[i] } }); } return { operations }; } return { operations: [] }; }Performance Cost (JavaScript)
171374 instructions
Output JSON (Rust)
{ "operations": [ { "paymentMethodHide": { "paymentMethodId": "pm_1", "placements": null } } ] }Output JSON (JavaScript)
{ "operations": [ { "paymentMethodHide": { "paymentMethodId": "pm_1" } } ] }Hide payment methods based on customer location
This example implements a Shopify function that hides certain payment methods based on the buyer's country code.cart.payment-methods.transform.run
Input Query (Rust)
query Input { localization { country { isoCode } } paymentMethods { id name } paymentCustomization { metafield(namespace: "$app:payment-customization", key: "function-configuration") { jsonValue } } }Input Query (JavaScript)
query CartPaymentMethodsTransformRunInput { localization { country { isoCode } } paymentMethods { id name } paymentCustomization { metafield(namespace: "$app:payment-customization", key: "function-configuration") { jsonValue } } }Input Object (Rust)
{ "localization": { "country": { "isoCode": "US" } }, "paymentMethods": [ { "id": "pm_1", "name": "SEPA Direct Debit" } ], "paymentCustomization": { "metafield": { "jsonValue": { "payment_methods": [ { "payment_method_id": "pm_1", "excluded_countries": [ "US", "CA" ] } ] } } } }Input Object (JavaScript)
{ "localization": { "country": { "isoCode": "US" } }, "paymentMethods": [ { "id": "pm_1", "name": "SEPA Direct Debit" } ], "paymentCustomization": { "metafield": { "jsonValue": { "payment_methods": [ { "payment_method_id": "pm_1", "excluded_countries": [ "US", "CA" ] } ] } } } }Function Code (Rust)
use crate::schema; use shopify_function::prelude::*; use shopify_function::Result; #[derive(Deserialize, Default, PartialEq)] struct PaymentMethodConfig { payment_method_id: String, excluded_countries: Vec<String>, } #[derive(Deserialize, Default, PartialEq)] pub struct Configuration { payment_methods: Vec<PaymentMethodConfig>, } #[shopify_function] fn cart_payment_methods_transform_run(input: schema::run::Input) -> Result<schema::CartPaymentMethodsTransformRunResult> { // Get configuration or return empty result if no metafield is set let config: &Configuration = match input.payment_customization().metafield() { Some(metafield) => metafield.json_value(), None => return Ok(schema::CartPaymentMethodsTransformRunResult { operations: vec![] }), }; let buyer_country = input.localization().country().iso_code(); // Create a set of payment method IDs let payment_methods: std::collections::HashSet<String> = input.payment_methods() .into_iter() .map(|method| method.id().to_string()) .collect(); // Find payment methods that should be hidden for the current country let operations = config.payment_methods .iter() .filter(|config| config.excluded_countries.contains(&buyer_country)) .filter(|config| payment_methods.contains(&config.payment_method_id)) .map(|config| { schema::Operation::PaymentMethodHide(schema::PaymentMethodHideOperation { payment_method_id: config.payment_method_id.clone(), placements: None, }) }) .collect(); Ok(schema::CartPaymentMethodsTransformRunResult { operations }) }Performance Cost (Rust)
38169 instructions
Function Code (JavaScript)
// @ts-check /** * @typedef {import("../generated/api").CartPaymentMethodsTransformRunInput} CartPaymentMethodsTransformRunInput * @typedef {import("../generated/api").CartPaymentMethodsTransformRunResult} CartPaymentMethodsTransformRunResult * @typedef {import("../generated/api").PaymentMethodHideOperation} PaymentMethodHideOperation * @typedef {import("../generated/api").Operation} Operation * * @typedef {Object} Configuration * @property {PaymentMethodConfiguration[]} payment_methods - Array of payment method configurations * * @typedef {Object} PaymentMethodConfiguration * @property {string} payment_method_id - ID of the payment method to customize * @property {string[]} excluded_countries - Array of country codes to exclude */ /** * @type {CartPaymentMethodsTransformRunResult} */ const NO_CHANGES = { operations: [], }; /** * @param {CartPaymentMethodsTransformRunInput} input * @returns {CartPaymentMethodsTransformRunResult} */ export function cartPaymentMethodsTransformRun(input) { /** @type {Configuration} */ const configuration = input.paymentCustomization?.metafield?.jsonValue; if (!configuration) { return NO_CHANGES; } const country = input.localization?.country; const buyerCountry = country ? country.isoCode : null; if (!buyerCountry) { return NO_CHANGES; } // Create a set of payment method IDs using a regular for loop const paymentMethodIds = new Set(); const paymentMethods = input.paymentMethods || []; for (let i = 0; i < paymentMethods.length; i++) { paymentMethodIds.add(paymentMethods[i].id); } /** @type {Operation[]} */ const operations = []; // Cache the length for better performance const configLength = configuration.payment_methods.length; for (let i = 0; i < configLength; i++) { const config = configuration.payment_methods[i]; if (config.excluded_countries.includes(buyerCountry) && paymentMethodIds.has(config.payment_method_id)) { operations.push({ paymentMethodHide: /** @type {PaymentMethodHideOperation} */ { paymentMethodId: config.payment_method_id } }); } } return { operations }; }Performance Cost (JavaScript)
201894 instructions
Output JSON (Rust)
{ "operations": [ { "paymentMethodHide": { "paymentMethodId": "pm_1", "placements": null } } ] }Output JSON (JavaScript)
{ "operations": [ { "paymentMethodHide": { "paymentMethodId": "pm_1" } } ] }Create an order review requirement for new B2B customers
This example implements a payment customization function that adds a review requirement to a B2B checkout when the company location has placed fewer than 10 orders in total.cart.payment-methods.transform.run
Input Query (Rust)
query Input { cart { buyerIdentity { purchasingCompany { location { id totalSpent { amount currencyCode } ordersCount } } } } }Input Query (JavaScript)
query CartPaymentMethodsTransformRunInput { cart { buyerIdentity { purchasingCompany { location { id totalSpent { amount currencyCode } ordersCount } } } } }Input Object (Rust)
{ "cart": { "buyerIdentity": { "purchasingCompany": { "location": { "id": "gid://shopify/CompanyLocation/1", "totalSpent": { "amount": "10000.00", "currencyCode": "USD" }, "ordersCount": 8 } } } } }Input Object (JavaScript)
{ "cart": { "buyerIdentity": { "purchasingCompany": { "location": { "id": "gid://shopify/CompanyLocation/1", "totalSpent": { "amount": "10000.00", "currencyCode": "USD" }, "ordersCount": 8 } } } } }Function Code (Rust)
use crate::schema; use shopify_function::prelude::*; use shopify_function::Result; #[shopify_function] fn cart_payment_methods_transform_run(input: schema::cart_payment_methods_transform_run::Input) -> Result<schema::CartPaymentMethodsTransformRunResult> { let company_orders_count = match input.cart().buyer_identity() { Some(buyer_identity) => match buyer_identity.purchasing_company() { Some(purchasing_company) => purchasing_company.location().orders_count(), None => return Ok(schema::CartPaymentMethodsTransformRunResult { operations: vec![] }), }, None => return Ok(schema::CartPaymentMethodsTransformRunResult { operations: vec![] }), }; let operations = if *company_orders_count < 10 { vec![schema::Operation::OrderReviewAdd( schema::OrderReviewAddOperation { reason: "Order placed by company location with less than 10 orders requires review.".to_string() } )] } else { vec![] }; Ok(schema::CartPaymentMethodsTransformRunResult { operations }) }Performance Cost (Rust)
19718 instructions
Function Code (JavaScript)
// @ts-check /** * @typedef {import("../generated/api").CartPaymentMethodsTransformRunInput} CartPaymentMethodsTransformRunInput * @typedef {import("../generated/api").CartPaymentMethodsTransformRunResult} CartPaymentMethodsTransformRunResult */ /** * @type {CartPaymentMethodsTransformRunResult} */ /** * @param {CartPaymentMethodsTransformRunInput} input * @returns {CartPaymentMethodsTransformRunResult} */ export function cartPaymentMethodsTransformRun(input) { const operations = []; const companyOrdersCount = input.cart?.buyerIdentity?.purchasingCompany?.location?.ordersCount; if (companyOrdersCount && companyOrdersCount < 10) { operations.push({ orderReviewAdd: { reason: "Order placed by company location with less than 10 orders requires review.", } }); } return { operations, }; };Performance Cost (JavaScript)
145881 instructions
Output JSON (Rust)
{ "operations": [ { "orderReviewAdd": { "reason": "Order placed by company location with less than 10 orders requires review." } } ] }Output JSON (JavaScript)
{ "operations": [ { "orderReviewAdd": { "reason": "Order placed by company location with less than 10 orders requires review." } } ] }Create an order review requirement for high-value B2B orders
This example implements a payment customization function that adds a review requirement to a B2B checkout when the cart total exceeds a certain amount.cart.payment-methods.transform.run
Input Query (Rust)
query Input { cart { cost { totalAmount { amount currencyCode } } } }Input Query (JavaScript)
query CartPaymentMethodsTransformRunInput { cart { cost { totalAmount { amount currencyCode } } } }Input Object (Rust)
{ "cart": { "cost": { "totalAmount": { "amount": "6000", "currencyCode": "USD" } } } }Input Object (JavaScript)
{ "cart": { "cost": { "totalAmount": { "amount": "6000", "currencyCode": "USD" } } } }Function Code (Rust)
use crate::schema; use shopify_function::prelude::*; use shopify_function::Result; // #[derive(Deserialize, Default, PartialEq)] // #[shopify_function(rename_all = "camelCase")] // pub struct Configuration {} #[shopify_function] fn cart_payment_methods_transform_run( input: schema::cart_payment_methods_transform_run::Input, ) -> Result<schema::CartPaymentMethodsTransformRunResult> { let cart_total = input.cart().cost().total_amount().amount(); let operations = if cart_total.0 > 5000.0 { vec![schema::Operation::OrderReviewAdd( schema::OrderReviewAddOperation { reason: "Orders over $5000 require review.".to_string() } )] } else { vec![] }; Ok(schema::CartPaymentMethodsTransformRunResult { operations }) }Performance Cost (Rust)
16793 instructions
Function Code (JavaScript)
// @ts-check /** * @typedef {import("../generated/api").CartPaymentMethodsTransformRunInput} CartPaymentMethodsTransformRunInput * @typedef {import("../generated/api").CartPaymentMethodsTransformRunResult} CartPaymentMethodsTransformRunResult */ /** * @type {CartPaymentMethodsTransformRunResult} */ /** * @param {CartPaymentMethodsTransformRunInput} input * @returns {CartPaymentMethodsTransformRunResult} */ export function cartPaymentMethodsTransformRun(input) { const cartTotal = input.cart?.cost?.totalAmount?.amount; const operations = []; if (cartTotal && cartTotal > 5000) { operations.push({ orderReviewAdd: { reason: "An order over $5000 requires review.", } }); } return { operations }; };Performance Cost (JavaScript)
127623 instructions
Output JSON (Rust)
{ "operations": [ { "orderReviewAdd": { "reason": "Orders over $5000 require review." } } ] }Output JSON (JavaScript)
{ "operations": [ { "orderReviewAdd": { "reason": "An order over $5000 requires review." } } ] }Apply payment terms and deposits based on cart total
This example implements a Shopify function that sets net payment terms with a deposit (15% to be collected upfront, the rest to be collected in 7 days) when the cart total is above a threshold amount.purchase.payment-customization.run
Input Query (Rust)
query Input { cart { cost { totalAmount { amount } } } paymentCustomization { metafield(namespace: "$app:payment-customization", key: "function-configuration") { jsonValue } } }Input Query (JavaScript)
query RunInput { cart { cost { totalAmount { amount } } } paymentCustomization { metafield(namespace: "$app:payment-customization", key: "function-configuration") { jsonValue } } }Input Object (Rust)
{ "cart": { "cost": { "totalAmount": { "amount": "700.00" } } }, "paymentCustomization": { "metafield": { "jsonValue": { "minimum_amount": 100.0, "deposit_minimum_amount": 500.0 } } } }Input Object (JavaScript)
{ "cart": { "cost": { "totalAmount": { "amount": "700.00" } } }, "paymentCustomization": { "metafield": { "jsonValue": { "minimum_amount": 100.0, "deposit_minimum_amount": 500.0 } } } }Function Code (Rust)
use crate::schema; use shopify_function::prelude::*; use shopify_function::Result; #[derive(Deserialize, Default, PartialEq)] pub struct Configuration { minimum_amount: Option<f64>, deposit_minimum_amount: Option<f64>, } #[shopify_function] fn run(input: schema::run::Input) -> Result<schema::FunctionRunResult> { let no_changes = schema::FunctionRunResult { operations: vec![] }; let config: &Configuration= match input.payment_customization().metafield() { Some(metafield) => metafield.json_value(), None => return Ok(no_changes), }; let minimum_amount = config.minimum_amount.unwrap_or(0.0); let deposit_minimum_amount = config.deposit_minimum_amount.unwrap_or(0.0); let cart_total = input.cart().cost().total_amount().amount().0; if cart_total >= minimum_amount { let mut net_terms = schema::NetPaymentTerms { due_in_days: 7, deposit: None, issued_at: None, }; if cart_total >= deposit_minimum_amount { net_terms.deposit = Some(schema::Deposit { percentage: 15.0, }); } return Ok(schema::FunctionRunResult { operations: vec![schema::Operation::PaymentTermsSet(schema::PaymentTermsSetOperation { payment_terms: Some(schema::PaymentTerms::Net(net_terms)), })], }); } Ok(no_changes) }Performance Cost (Rust)
28638 instructions
Function Code (JavaScript)
// @ts-check /** * @typedef {import("../generated/api").RunInput} RunInput * @typedef {import("../generated/api").FunctionRunResult} FunctionRunResult * @typedef {import("../generated/api").NetPaymentTerms} NetPaymentTerms */ /** * @type {FunctionRunResult} */ const NO_CHANGES = { operations: [], }; /** * @param {RunInput} input - The function input containing cart and configuration data * @returns {FunctionRunResult} - The function result containing operations */ export function run(input) { const configuration = input.paymentCustomization.metafield?.jsonValue ?? {}; if (!configuration.minimum_amount) { return NO_CHANGES; } const cartTotal = parseFloat(input.cart.cost.totalAmount.amount); const depositMinimumAmount = parseFloat(configuration.deposit_minimum_amount); /** @type {NetPaymentTerms} */ let net_payment_terms = { dueInDays: 7, issuedAt: null, deposit: null }; if (cartTotal >= depositMinimumAmount) { net_payment_terms = { dueInDays: 7, issuedAt: null, deposit: { percentage: 15.0 } }; } // if cart total is above minimum, set payment terms to "Net 7", without a deposit. // if cart total also exceeds the amount required for a deposit, set a 15% deposit, // with the remaining balance due in 7 days. if (cartTotal >= configuration.minimum_amount) { return { operations: [ { paymentTermsSet: { paymentTerms: { net: net_payment_terms } } } ] } } return NO_CHANGES; };Performance Cost (JavaScript)
196889 instructions
Output JSON (Rust)
{ "operations": [ { "paymentTermsSet": { "paymentTerms": { "net": { "dueInDays": 7, "deposit": { "percentage": 15.0 }, "issuedAt": null } } } } ] }Output JSON (JavaScript)
{ "operations": [ { "paymentTermsSet": { "paymentTerms": { "net": { "dueInDays": 7, "deposit": { "percentage": 15.0 }, "issuedAt": null } } } } ] }Remove payment terms for B2B buyers
This example implements a Shopify function that sets no payment terms when the buyer is B2B. If the buyer is D2C, this function is a no-op.purchase.payment-customization.run
Input Query (Rust)
query Input { cart { buyerIdentity { purchasingCompany { company { id } } } } }Input Query (JavaScript)
query RunInput { cart { buyerIdentity { purchasingCompany { company { id } } } } }Input Object (Rust)
{ "cart": { "buyerIdentity": { "purchasingCompany": { "company": { "id": "gid://Shopify/Company/1" } } } } }Input Object (JavaScript)
{ "cart": { "buyerIdentity": { "purchasingCompany": { "company": { "id": "gid://Shopify/Company/1" } } } } }Function Code (Rust)
use crate::schema; use shopify_function::prelude::*; use shopify_function::Result; #[shopify_function] fn run(input: schema::run::Input) -> Result<schema::FunctionRunResult> { let no_changes = schema::FunctionRunResult { operations: vec![] }; let b2b_customer = input.cart().buyer_identity() .and_then(|buyer_identity| buyer_identity.purchasing_company()) .map(|purchasing_company| purchasing_company.company()) .is_some(); if b2b_customer { return Ok(schema::FunctionRunResult { operations: vec![schema::Operation::PaymentTermsSet(schema::PaymentTermsSetOperation { payment_terms: None, })], }); } Ok(no_changes) }Performance Cost (Rust)
16565 instructions
Function Code (JavaScript)
// @ts-check /** * @typedef {import("../generated/api").RunInput} RunInput * @typedef {import("../generated/api").FunctionRunResult} FunctionRunResult */ /** * @type {FunctionRunResult} */ const NO_CHANGES = { operations: [], }; /** * @param {RunInput} input * @returns {FunctionRunResult} */ export function run(input) { const b2b_customer = !!input.cart.buyerIdentity?.purchasingCompany?.company; if (b2b_customer) { return { operations: [{ paymentTermsSet: { paymentTerms: null } }] } } return NO_CHANGES; };Performance Cost (JavaScript)
130325 instructions
Output JSON (Rust)
{ "operations": [ { "paymentTermsSet": { "paymentTerms": null } } ] }Output JSON (JavaScript)
{ "operations": [ { "paymentTermsSet": { "paymentTerms": null } } ] }Hide gift card payment methods
This example implements a Shopify function that disables using gift cards for payment.cart.payment-methods.transform.run
Input Query (Rust)
query Input { paymentMethods { id name } }Input Query (JavaScript)
query CartPaymentMethodsTransformRunInput { paymentMethods { id name } }Input Object (Rust)
{ "paymentMethods": [ { "id": "gid://shopify/PaymentCustomizationPaymentMethod/0", "name": "(for testing) Bogus Gateway" }, { "id": "gid://shopify/PaymentCustomizationPaymentMethod/1", "name": "Deferred" }, { "id": "gid://shopify/PaymentCustomizationPaymentMethod/2", "name": "Bank Deposit" }, { "id": "gid://shopify/PaymentCustomizationPaymentMethod/3", "name": "Gift card" } ] }Input Object (JavaScript)
{ "paymentMethods": [ { "id": "gid://shopify/PaymentCustomizationPaymentMethod/0", "name": "(for testing) Bogus Gateway" }, { "id": "gid://shopify/PaymentCustomizationPaymentMethod/1", "name": "Deferred" }, { "id": "gid://shopify/PaymentCustomizationPaymentMethod/2", "name": "Bank Deposit" }, { "id": "gid://shopify/PaymentCustomizationPaymentMethod/3", "name": "Gift card" } ] }Function Code (Rust)
use crate::schema; use shopify_function::prelude::*; use shopify_function::Result; #[shopify_function] fn cart_payment_methods_transform_run(input: schema::run::Input) -> Result<schema::CartPaymentMethodsTransformRunResult> { // Find payment methods that contain "Gift card" in their name let operations: Vec<schema::Operation> = input.payment_methods() .into_iter() .filter(|method| method.name().to_ascii_lowercase().contains("gift card")) .map(|method| { schema::Operation::PaymentMethodHide(schema::PaymentMethodHideOperation { payment_method_id: method.id().to_string(), placements: None, }) }) .collect(); Ok(schema::CartPaymentMethodsTransformRunResult { operations }) }Performance Cost (Rust)
32938 instructions
Function Code (JavaScript)
// @ts-check /** * @typedef {import("../generated/api").CartPaymentMethodsTransformRunInput} CartPaymentMethodsTransformRunInput * @typedef {import("../generated/api").CartPaymentMethodsTransformRunResult} CartPaymentMethodsTransformRunResult * @typedef {import("../generated/api").PaymentMethodHideOperation} PaymentMethodHideOperation * @typedef {import("../generated/api").Operation} Operation */ /** * @param {CartPaymentMethodsTransformRunInput} input * @returns {CartPaymentMethodsTransformRunResult} */ export function cartPaymentMethodsTransformRun(input) { // Find payment methods that contain "Gift card" in their name const operations = (input.paymentMethods || []) .filter(method => method.name.toLowerCase().includes("gift card")) .map(method => ({ paymentMethodHide: { paymentMethodId: method.id } })); return { operations }; }Performance Cost (JavaScript)
188352 instructions
Output JSON (Rust)
{ "operations": [ { "paymentMethodHide": { "paymentMethodId": "gid://shopify/PaymentCustomizationPaymentMethod/3", "placements": null } } ] }Output JSON (JavaScript)
{ "operations": [ { "paymentMethodHide": { "paymentMethodId": "gid://shopify/PaymentCustomizationPaymentMethod/3" } } ] }
Input query
Input object (response)
JSONFunction code
Rust
use crate::schema;
use shopify_function::prelude::*;
use shopify_function::Result;
#[derive(Deserialize, Default, PartialEq)]
pub struct Configuration {
payment_methods: Vec<String>,
}
#[shopify_function]
fn cart_payment_methods_transform_run(input: schema::run::Input) -> Result<schema::CartPaymentMethodsTransformRunResult> {
let config: &Configuration = match input.payment_customization().metafield() {
Some(metafield) => metafield.json_value(),
None => return Ok(schema::CartPaymentMethodsTransformRunResult { operations: vec![] }),
};
let mut operations = vec![];
for (index, method_name) in config.payment_methods.iter().enumerate() {
if let Some(method) = input.payment_methods().iter().find(|m| m.name() == method_name) {
operations.push(schema::Operation::PaymentMethodMove(schema::PaymentMethodMoveOperation {
payment_method_id: method.id().to_string(),
index: index as i32,
}));
}
}
Ok(schema::CartPaymentMethodsTransformRunResult { operations })
}
JavaScript
use crate::schema;
use shopify_function::prelude::*;
use shopify_function::Result;
#[derive(Deserialize, Default, PartialEq)]
pub struct Configuration {
payment_methods: Vec<String>,
}
#[shopify_function]
fn cart_payment_methods_transform_run(input: schema::run::Input) -> Result<schema::CartPaymentMethodsTransformRunResult> {
let config: &Configuration = match input.payment_customization().metafield() {
Some(metafield) => metafield.json_value(),
None => return Ok(schema::CartPaymentMethodsTransformRunResult { operations: vec![] }),
};
let mut operations = vec![];
for (index, method_name) in config.payment_methods.iter().enumerate() {
if let Some(method) = input.payment_methods().iter().find(|m| m.name() == method_name) {
operations.push(schema::Operation::PaymentMethodMove(schema::PaymentMethodMoveOperation {
payment_method_id: method.id().to_string(),
index: index as i32,
}));
}
}
Ok(schema::CartPaymentMethodsTransformRunResult { operations })
}
Function run result
JSONAnchor to Plan and geographical restrictionsPlan and geographical restrictions
Plan and geographical restrictions apply. Learn more.
When the Payment Customization API usage is restricted, the function input still contains all payment methods. However, output operations that target restricted payment methods don't take effect at checkout.
When the Payment Customization API usage is restricted, the function input still contains all payment methods. However, output operations that target restricted payment methods don't take effect at checkout.
Anchor to Payment method naming rulesPayment method naming rules
You can't rename payment methods that have logos as a name, such as Shop Pay, Apple Pay and Google Pay. This also includes all wallets and the Shopify native gift card field.
Anchor to Shop Pay integrationShop Pay integration
In Shop Pay, payment customization functions only apply operations on the native gift card field and not on other payment methods.
Anchor to Wallet payment methodsWallet payment methods
You can remove wallets from the Express or payment method section of checkout, but you can't reorder them.
Anchor to Additional resourcesAdditional resources
Explore comprehensive guides and references to help you build, deploy, and optimize your Shopify Functions.
Anchor to Working with FunctionsWorking with Functions
These guides cover essential concepts for building Shopify Functions effectively. Learn how functions process data, execute during checkout, and handle versioning, localization, and external APIs.
Anchor to Performance and troubleshootingPerformance and troubleshooting
Optimize function performance and ensure reliable operation from development through production deployment.