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
1mutation cartTransformCreate($blockOnFailure: Boolean, $functionId: String!, $metafields: [MetafieldInput!]) {2 cartTransformCreate(blockOnFailure: $blockOnFailure, functionId: $functionId, metafields: $metafields) {3 cartTransform {4 # CartTransform fields5 }6 userErrors {7 field8 message9 }10 }11}
Input
1{2 "blockOnFailure": true,3 "functionId": "<your-functionId>",4 "metafields": [5 {6 "id": "gid://shopify/<objectName>/10079785100",7 "key": "<your-key>",8 "namespace": "<your-namespace>",9 "type": "<your-type>",10 "value": "<your-value>"11 }12 ]13}
{
"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
}