Anchor to section titled 'undefined'

cartTransformCreate
mutation

Requires write_cart_transforms 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 blockOnFailure
blockOnFailure
default:false

Whether a run failure should block cart and checkout operations.

Anchor to functionId
functionId
required

The identifier of the Function providing the cart transform.

Additional metafields to associate to the cart transform.


Was this section helpful?

The newly created cart transform function.

The list of errors that occurred from executing the mutation.


Was this section helpful?
Hide code
Mutation reference
Copy
mutation cartTransformCreate($functionId: String!) {
  cartTransformCreate(functionId: $functionId) {
    cartTransform {
      # CartTransform fields
    }
    userErrors {
      field
      message
    }
  }
}
Hide code
Input
Copy
{
  "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
}