Skip to main content

Customize form controls

Checkout forms consist of different UI components for user input, such as Checkbox, DatePicker, and TextField.

This guide teaches you how to use the GraphQL Admin API to customize form controls, beyond what you can customize using the checkout editor. In some cases, you'll style form controls using design system tokens.

You'll learn some sample customizations, but you can use what you've learned to make other form control customizations.

Tip

You can reset styles to their defaults by writing parent fields to null with the GraphQL Admin API. Refer to examples of resetting some and all values to the defaults.


In this tutorial, you'll learn how to do the following tasks:

  • Retrieve a list of your store's checkout profile IDs.
  • Customize the label position and corner radius for all form controls.
  • Customize checkboxes to add a distinct corner radius.
  • Customize buttons to add inner padding and a distinct corner radius.


Anchor to Step 1: Retrieve the store's published checkout profile IDStep 1: Retrieve the store's published checkout profile ID


Anchor to Step 2: Set the label position and corner radiusStep 2: Set the label position and corner radius

In this step, you'll set the label position and then the corner radius for form controls. For both styles, you'll use the checkoutBrandingUpsert mutation's customizations object and the CheckoutBrandingInput input object.

  1. Set the label position.

    The following example puts labels outside fields. This keeps field labels visible when users are typing inputs, and improves accessibility.

    POST https://{shop}.myshopify.com/api/{api_version}/graphql.json

    GraphQL mutation

    mutation CustomizingControls($checkoutBrandingInput: CheckoutBrandingInput!, $checkoutProfileId: ID!) {
    checkoutBrandingUpsert(checkoutBrandingInput: $checkoutBrandingInput, checkoutProfileId: $checkoutProfileId) {
    checkoutBranding {
    customizations {
    control {
    labelPosition
    }
    }
    }
    userErrors {
    field
    message
    }
    }
    }

    Query variables

    {
    "checkoutProfileId": "gid://shopify/CheckoutProfile/YOUR_CHECKOUT_PROFILE_ID_HERE",
    "checkoutBrandingInput": {
    "customizations": {
    "control": {
    "labelPosition": "OUTSIDE"
    }
    }
    }
    }

    JSON response

    {
    "data": {
    "checkoutBrandingUpsert": {
    "checkoutBranding": {
    "customizations": {
    "control": {
    "labelPosition": "OUTSIDE"
    }
    }
    },
    "userErrors": []
    }
    }
    }
  2. Set the corner radius.

    POST https://{shop}.myshopify.com/api/{api_version}/graphql.json

    GraphQL mutation

    mutation CustomizingControls($checkoutBrandingInput: CheckoutBrandingInput!, $checkoutProfileId: ID!) {
    checkoutBrandingUpsert(checkoutBrandingInput: $checkoutBrandingInput, checkoutProfileId: $checkoutProfileId) {
    checkoutBranding {
    customizations {
    control {
    cornerRadius
    }
    }
    }
    userErrors {
    field
    message
    }
    }
    }

    Query variables

    {
    "checkoutProfileId": "gid://shopify/CheckoutProfile/YOUR_CHECKOUT_PROFILE_ID_HERE",
    "checkoutBrandingInput": {
    "customizations": {
    "control": {
    "cornerRadius": "LARGE"
    }
    }
    }
    }

    JSON response

    {
    "data": {
    "checkoutBrandingUpsert": {
    "checkoutBranding": {
    "customizations": {
    "control": {
    "cornerRadius": "LARGE"
    }
    }
    },
    "userErrors": []
    }
    }
    }
Form field labels displaying above fields that have a slightly rounded edge

Anchor to Step 3: Set the corner radius for checkboxesStep 3: Set the corner radius for checkboxes

At this point, checkboxes have the corner radius that you set for form controls. However, this style makes the checkboxes look like radio buttons. In this step, you'll adjust the checkbox's corner radius to visually distinguish it as a checkbox and make its function clear.

POST https://{shop}.myshopify.com/api/{api_version}/graphql.json

GraphQL mutation

mutation CustomizingControls($checkoutBrandingInput: CheckoutBrandingInput!, $checkoutProfileId: ID!) {
checkoutBrandingUpsert(checkoutBrandingInput: $checkoutBrandingInput, checkoutProfileId: $checkoutProfileId) {
checkoutBranding {
customizations {
checkbox {
cornerRadius
}
}
}
userErrors {
field
message
}
}
}

Query variables

{
"checkoutProfileId": "gid://shopify/CheckoutProfile/YOUR_CHECKOUT_PROFILE_ID_HERE",
"checkoutBrandingInput": {
"customizations": {
"checkbox": {
"cornerRadius": "BASE"
}
}
}
}

JSON response

{
"data": {
"checkoutBrandingUpsert": {
"checkoutBranding": {
"customizations": {
"checkbox": {
"cornerRadius": "BASE"
}
}
},
"userErrors": []
}
}
}
The checkbox as a square with slightly rounded edges

Anchor to Step 4: Style primary buttonsStep 4: Style primary buttons

The customizations for control don't apply to buttons. In this step, you'll style the corner radius and padding for primary buttons. For both styles, you'll use the checkoutBrandingUpsert mutation's customizations object and the CheckoutBrandingInput input object.

  1. Set the corner radius.

    The following example shapes the buttons as rectangles with sharp corners, which affects the perceived clickability of the button.

    POST https://{shop}.myshopify.com/api/{api_version}/graphql.json

    GraphQL mutation

    mutation CustomizingControls($checkoutBrandingInput: CheckoutBrandingInput!, $checkoutProfileId: ID!) {
    checkoutBrandingUpsert(checkoutBrandingInput: $checkoutBrandingInput, checkoutProfileId: $checkoutProfileId) {
    checkoutBranding {
    customizations {
    primaryButton {
    cornerRadius
    }
    }
    }
    userErrors {
    field
    message
    }
    }

    Query variables

    {
    "checkoutProfileId": "gid://shopify/CheckoutProfile/YOUR_CHECKOUT_PROFILE_ID_HERE",
    "checkoutBrandingInput": {
    "customizations": {
    "primaryButton": {
    "cornerRadius": "NONE"
    }
    }
    }
    }

    JSON response

    {
    "data": {
    "checkoutBrandingUpsert": {
    "checkoutBranding": {
    "customizations": {
    "primaryButton": {
    "cornerRadius": "NONE"
    }
    }
    },
    "userErrors": []
    }
    }
    }
  2. Set the inline padding.

    The following example helps to ensure that the label doesn't touch the button edges, which improves readability and aesthetics.

    POST https://{shop}.myshopify.com/api/{api_version}/graphql.json

    GraphQL mutation

    mutation CustomizingControls($checkoutBrandingInput: CheckoutBrandingInput!, $checkoutProfileId: ID!) {
    checkoutBrandingUpsert(checkoutBrandingInput: $checkoutBrandingInput, checkoutProfileId: $checkoutProfileId) {
    checkoutBranding {
    customizations {
    primaryButton {
    inlinePadding
    }
    }
    }
    userErrors {
    field
    message
    }
    }
    }

    Query variables

    {
    "checkoutProfileId": "gid://shopify/CheckoutProfile/YOUR_CHECKOUT_PROFILE_ID_HERE",
    "checkoutBrandingInput": {
    "customizations": {
    "primaryButton": {
    "inlinePadding": "BASE"
    }
    }
    }
    }

    JSON response

    {
    "data": {
    "checkoutBrandingUpsert": {
    "checkoutBranding": {
    "customizations": {
    "primaryButton": {
    "inlinePadding": "BASE"
    }
    }
    },
    "userErrors": []
    }
    }
    }
Buttons as rectangles with sharp edges. The button

  • Explore the GraphQL Admin API to learn more about customizing checkout's form controls.

Was this page helpful?