--- title: fulfillmentConstraintRuleCreate - GraphQL Admin description: Creates a fulfillment constraint rule and its metafield. api_version: 2025-10 api_name: admin type: mutation api_type: graphql source_url: html: https://shopify.dev/docs/api/admin-graphql/latest/mutations/fulfillmentconstraintrulecreate md: https://shopify.dev/docs/api/admin-graphql/latest/mutations/fulfillmentconstraintrulecreate.md --- # fulfillment​Constraint​Rule​Create mutation Requires `write_fulfillment_constraint_rules` access scope. Creates a fulfillment constraint rule and its metafield. ## Arguments * delivery​Method​Types [\[Delivery​Method​Type!\]!](https://shopify.dev/docs/api/admin-graphql/latest/enums/DeliveryMethodType) required Associate the function with one or multiple delivery method types. * function​Handle [String](https://shopify.dev/docs/api/admin-graphql/latest/scalars/String) The handle of the function providing the constraint rule. * metafields [\[Metafield​Input!\]](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldInput) Default:\[] Metafields to associate to the fulfillment constraint rule. * function​Id [String](https://shopify.dev/docs/api/admin-graphql/latest/scalars/String) Deprecated *** ## Fulfillment​Constraint​Rule​Create​Payload returns * fulfillment​Constraint​Rule [Fulfillment​Constraint​Rule](https://shopify.dev/docs/api/admin-graphql/latest/objects/FulfillmentConstraintRule) The newly created fulfillment constraint rule. * user​Errors [\[Fulfillment​Constraint​Rule​Create​User​Error!\]!](https://shopify.dev/docs/api/admin-graphql/latest/objects/FulfillmentConstraintRuleCreateUserError) non-null The list of errors that occurred from executing the mutation. *** ## Examples * ### fulfillmentConstraintRuleCreate reference ## Mutation Reference ```graphql mutation fulfillmentConstraintRuleCreate($functionHandle: String, $deliveryMethodTypes: [DeliveryMethodType!]!, $metafields: [MetafieldInput!]) { fulfillmentConstraintRuleCreate(functionHandle: $functionHandle, deliveryMethodTypes: $deliveryMethodTypes, metafields: $metafields) { fulfillmentConstraintRule { # FulfillmentConstraintRule fields } userErrors { field message } } } ``` ## Input ```json { "functionHandle": "", "deliveryMethodTypes": [ "SHIPPING" ], "metafields": [ { "id": "gid://shopify//10079785100", "namespace": "", "key": "", "value": "", "type": "" } ] } ``` ##### Variables ``` { "functionHandle": "", "deliveryMethodTypes": [ "SHIPPING" ], "metafields": [ { "id": "gid://shopify//10079785100", "namespace": "", "key": "", "value": "", "type": "" } ] } ``` ##### Schema ``` input MetafieldInput { id: ID namespace: String key: String value: String type: String } ```