Anchor to cartTransformCreatecart
cartTransformCreate
mutation
Requires access scope. Also: The shop must have upgraded to Checkout Extensibility and the user must have products and preferences permission to create a cart transform function.
Create a CartTransform function to the Shop.
Anchor to Arguments
Arguments
- Anchor to blockOnFailureblock•
On Failure BooleanDefault:false Whether a run failure should block cart and checkout operations.
- Anchor to functionIdfunction•
Id String!required The identifier of the Function providing the cart transform.
- Anchor to metafieldsmetafields•[Metafield
Input!] Default:[] Additional metafields to associate to the cart transform.
Was this section helpful?
Anchor to CartTransformCreatePayload returnsCartTransformCreatePayload returns
- Anchor to cartTransformcart•
Transform The newly created cart transform function.
- Anchor to userErrorsuser•
Errors [CartTransform non-nullCreate User Error!]! The list of errors that occurred from executing the mutation.
Was this section helpful?
Mutation Reference
mutation cartTransformCreate($blockOnFailure: Boolean, $functionId: String!, $metafields: [MetafieldInput!]) {
cartTransformCreate(blockOnFailure: $blockOnFailure, functionId: $functionId, metafields: $metafields) {
cartTransform {
# CartTransform fields
}
userErrors {
field
message
}
}
}
Input
{
"blockOnFailure": true,
"functionId": "<your-functionId>",
"metafields": [
{
"id": "gid://shopify/<objectName>/10079785100",
"key": "<your-key>",
"namespace": "<your-namespace>",
"type": "<your-type>",
"value": "<your-value>"
}
]
}
{
"blockOnFailure": true,
"functionId": "<your-functionId>",
"metafields": [
{
"id": "gid://shopify/<objectName>/10079785100",
"key": "<your-key>",
"namespace": "<your-namespace>",
"type": "<your-type>",
"value": "<your-value>"
}
]
}
input MetafieldInput {
description: String
id: ID
key: String
namespace: String
type: String
value: String
}